Module: Ore::Template::Helpers::Markdown

Defined in:
lib/ore/template/helpers/markdown.rb

Overview

Since:

  • 0.10.0

Instance Method Summary collapse

Instance Method Details

#h1(title) ⇒ String

Emits a markdown h1 heading.

Since:

  • 0.10.0


43
44
45
# File 'lib/ore/template/helpers/markdown.rb', line 43

def h1(title)
  "# #{title}"
end

#h2(title) ⇒ String

Emits a markdown h2 heading.

Since:

  • 0.10.0


54
55
56
# File 'lib/ore/template/helpers/markdown.rb', line 54

def h2(title)
  "## #{title}"
end

#h3(title) ⇒ String

Emits a markdown h3 heading.

Since:

  • 0.10.0


65
66
67
# File 'lib/ore/template/helpers/markdown.rb', line 65

def h3(title)
  "### #{title}"
end

#h4(title) ⇒ String

Emits a markdown h4 heading.

Since:

  • 0.10.0


76
77
78
# File 'lib/ore/template/helpers/markdown.rb', line 76

def h4(title)
  "#### #{title}"
end

#image(url, alt = nil) ⇒ String

Emits a markdown image.

Since:

  • 0.10.0


32
33
34
# File 'lib/ore/template/helpers/markdown.rb', line 32

def image(url,alt=nil)
  "![#{alt}](#{url})"
end

Emits a markdown link.

Since:

  • 0.10.0


19
20
21
# File 'lib/ore/template/helpers/markdown.rb', line 19

def link_to(text,url)
  "[#{text}](#{url})"
end

#pre(code) { ... } ⇒ String

Emits a markdown code block.

Yields:

  • [] The return value of the given block will be used as the code.

Since:

  • 0.10.0


90
91
92
# File 'lib/ore/template/helpers/markdown.rb', line 90

def pre(code)
  code.each_line.map { |line| "    #{line}" }.join
end