Class: TTY::Markdown::Converter
- Inherits:
-
Kramdown::Converter::Base
- Object
- Kramdown::Converter::Base
- TTY::Markdown::Converter
- Defined in:
- lib/tty/markdown/converter.rb
Overview
Converts a Kramdown::Document tree to a terminal friendly output
Constant Summary collapse
- NEWLINE =
"\n"
- SPACE =
" "
Instance Method Summary collapse
-
#convert(el, opts = { indent: 0 }) ⇒ Object
Invoke an element conversion.
-
#initialize(root, options = {}) ⇒ Converter
constructor
A new instance of Converter.
Constructor Details
#initialize(root, options = {}) ⇒ Converter
Returns a new instance of Converter.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/tty/markdown/converter.rb', line 18 def initialize(root, = {}) super @current_indent = 0 @indent = [:indent] @pastel = Pastel.new(enabled: [:enabled]) @color_opts = { mode: [:mode], color: @pastel.yellow.detach, enabled: [:enabled] } @width = [:width] @theme = [:theme] @symbols = [:symbols] @footnote_no = 1 @footnotes = {} end |
Instance Method Details
#convert(el, opts = { indent: 0 }) ⇒ Object
Invoke an element conversion
36 37 38 |
# File 'lib/tty/markdown/converter.rb', line 36 def convert(el, opts = { indent: 0 }) send("convert_#{el.type}", el, opts) end |