Class: Troy::Markdown
- Inherits:
-
Object
- Object
- Troy::Markdown
- Defined in:
- lib/troy/markdown.rb
Defined Under Namespace
Modules: PrismJs, Rouge Classes: Renderer
Instance Attribute Summary collapse
-
#markup ⇒ Object
readonly
Set the Markdown markup that must be rendered.
Instance Method Summary collapse
-
#initialize(markup) ⇒ Markdown
constructor
A new instance of Markdown.
- #renderer ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(markup) ⇒ Markdown
Returns a new instance of Markdown.
31 32 33 |
# File 'lib/troy/markdown.rb', line 31 def initialize(markup) @markup = markup end |
Instance Attribute Details
#markup ⇒ Object (readonly)
Set the Markdown markup that must be rendered.
29 30 31 |
# File 'lib/troy/markdown.rb', line 29 def markup @markup end |
Instance Method Details
#renderer ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/troy/markdown.rb', line 35 def renderer @renderer ||= Redcarpet::Markdown.new(Renderer, autolink: true, space_after_headers: true, fenced_code_blocks: true, footnotes: true) end |
#to_html ⇒ Object
43 44 45 |
# File 'lib/troy/markdown.rb', line 43 def to_html renderer.render(markup) end |