Class: TTY::Markdown::Converter

Inherits:
Kramdown::Converter::Base
  • Object
show all
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

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, options = {})
  super
  @current_indent = 0
  @indent = options[:indent]
  @pastel = Pastel.new(enabled: options[:enabled])
  @color_opts = { mode: options[:mode],
                  color: @pastel.yellow.detach,
                  enabled: options[:enabled] }
  @width = options[:width]
  @theme = options[:theme]
  @symbols = options[: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