Class: Charming::Presentation::Components::Markdown

Inherits:
Charming::Presentation::Component show all
Defined in:
lib/charming/presentation/components/markdown.rb

Instance Method Summary collapse

Methods inherited from View

#focused?, #layout_assigns

Constructor Details

#initialize(content:, width: nil, theme: nil, syntax_highlighting: true) ⇒ Markdown

Returns a new instance of Markdown.



7
8
9
10
11
12
# File 'lib/charming/presentation/components/markdown.rb', line 7

def initialize(content:, width: nil, theme: nil, syntax_highlighting: true)
  super(theme: theme)
  @content = content
  @width = width
  @syntax_highlighting = syntax_highlighting
end

Instance Method Details

#renderObject



14
15
16
17
18
19
20
21
# File 'lib/charming/presentation/components/markdown.rb', line 14

def render
  Charming::Presentation::Markdown::Renderer.new(
    content: @content,
    width: @width,
    theme: theme,
    syntax_highlighting: @syntax_highlighting
  ).render
end