Class: Vimdeck::Render
- Inherits:
-
Redcarpet::Render::Base
- Object
- Redcarpet::Render::Base
- Vimdeck::Render
- Defined in:
- lib/vimdeck.rb
Overview
Custom Redcarpet renderer handles headers and images Code blocks are ignored by the renderer because they have to be measured for the vimscript, so parsing of the fenced code blocks happens in the slideshow generator itself
Instance Method Summary collapse
- #block_code(code, language) ⇒ Object
- #header(title, level) ⇒ Object
- #image(image, title, alt_text) ⇒ Object
- #link(link, title, content) ⇒ Object
- #list(content, type) ⇒ Object
- #paragraph(text) ⇒ Object
Instance Method Details
#block_code(code, language) ⇒ Object
81 82 83 |
# File 'lib/vimdeck.rb', line 81 def block_code(code, language) "```#{language}\n#{code}\n```" end |
#header(title, level) ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/vimdeck.rb', line 63 def header(title, level) case level when 1 Vimdeck::Ascii.header(title, "large") + "\n" when 2 Vimdeck::Ascii.header(title, "small") + "\n" end end |
#image(image, title, alt_text) ⇒ Object
85 86 87 |
# File 'lib/vimdeck.rb', line 85 def image(image, title, alt_text) Vimdeck::Ascii.image(image) end |
#link(link, title, content) ⇒ Object
73 74 75 |
# File 'lib/vimdeck.rb', line 73 def link(link, title, content) content end |
#list(content, type) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/vimdeck.rb', line 55 def list(content, type) if type == :unordered "<!~#{content}~!>" else "<@~#{content}~@>" end end |
#paragraph(text) ⇒ Object
77 78 79 |
# File 'lib/vimdeck.rb', line 77 def paragraph(text) text + "\n" end |