Class: Charming::Presentation::Markdown::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/charming/presentation/markdown/renderer.rb

Constant Summary collapse

DEFAULT_RULE_WIDTH =
40

Instance Method Summary collapse

Constructor Details

#initialize(content:, width: nil, theme: UI::Theme.default, syntax_highlighting: true) ⇒ Renderer

Returns a new instance of Renderer.



11
12
13
14
15
16
# File 'lib/charming/presentation/markdown/renderer.rb', line 11

def initialize(content:, width: nil, theme: UI::Theme.default, syntax_highlighting: true)
  @content = content
  @width = width
  @theme = theme || UI::Theme.default
  @syntax_highlighting = syntax_highlighting
end

Instance Method Details

#renderObject



18
19
20
21
# File 'lib/charming/presentation/markdown/renderer.rb', line 18

def render
  document = Kramdown::Document.new(content.to_s)
  render_blocks(document.root.children)
end