Class: TTY::Markdown::Parser
- Inherits:
-
Kramdown::Converter::Base
- Object
- Kramdown::Converter::Base
- TTY::Markdown::Parser
- Defined in:
- lib/tty/markdown/parser.rb
Overview
Converts a Kramdown::Document tree to a terminal friendly output
Instance Method Summary collapse
-
#convert(el, opts = { indent: 0, result: [] }) ⇒ Object
Invoke an element conversion.
-
#initialize(root, **options) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(root, **options) ⇒ Parser
Returns a new instance of Parser.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tty/markdown/parser.rb', line 15 def initialize(root, **) super @stack = [] @current_indent = 0 @indent = .fetch(:indent, 2) @pastel = Pastel.new @color_opts = { mode: [:colors] } @width = .fetch(:width) { TTY::Screen.width } @theme = .fetch(:theme) { TTY::Markdown::THEME } end |
Instance Method Details
#convert(el, opts = { indent: 0, result: [] }) ⇒ Object
Invoke an element conversion
29 30 31 |
# File 'lib/tty/markdown/parser.rb', line 29 def convert(el, opts = { indent: 0, result: [] }) send("convert_#{el.type}", el, opts) end |