Module: Ore::Template::Helpers::Markdown
- Defined in:
- lib/ore/template/helpers/markdown.rb
Overview
Instance Method Summary collapse
-
#h1(title) ⇒ String
Emits a markdown h1 heading.
-
#h2(title) ⇒ String
Emits a markdown h2 heading.
-
#h3(title) ⇒ String
Emits a markdown h3 heading.
-
#h4(title) ⇒ String
Emits a markdown h4 heading.
-
#image(url, alt = nil) ⇒ String
Emits a markdown image.
-
#link_to(text, url) ⇒ String
Emits a markdown link.
-
#pre(code) { ... } ⇒ String
Emits a markdown code block.
Instance Method Details
#h1(title) ⇒ String
Emits a markdown h1 heading.
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.
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.
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.
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.
32 33 34 |
# File 'lib/ore/template/helpers/markdown.rb', line 32 def image(url,alt=nil) "![#{alt}](#{url})" end |
#link_to(text, url) ⇒ String
Emits a markdown link.
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.
90 91 92 |
# File 'lib/ore/template/helpers/markdown.rb', line 90 def pre(code) code.each_line.map { |line| " #{line}" }.join end |