Class: Marvi::ASTWalker

Inherits:
Object
  • Object
show all
Defined in:
lib/marvi/ast_walker.rb

Constant Summary collapse

HEADER_COLORS =
%i[cyan green yellow magenta white white].freeze

Instance Method Summary collapse

Instance Method Details

#walk(markdown) ⇒ Object



10
11
12
13
14
15
# File 'lib/marvi/ast_walker.rb', line 10

def walk(markdown)
  doc = Kramdown::Document.new(markdown, input: "GFM")
  lines = render_block(doc.root)
  lines.pop while lines.last&.plain_text&.empty?
  lines
end