Module: TTYMarkdownConverterExtension
- Included in:
- TTY::Markdown::Converter
- Defined in:
- lib/bk/annotation_formatter/markdown.rb
Instance Method Summary collapse
- #color_from_span_class(css_class) ⇒ Object
- #convert_html_element(el, opts) ⇒ Object
- #pastel ⇒ Object
Instance Method Details
#color_from_span_class(css_class) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/bk/annotation_formatter/markdown.rb', line 13 def color_from_span_class(css_class) match = css_class.match(/^term-(?:[fb]g)(\d+)$/) return unless match color_code = Integer(match[1]) Pastel::ANSI::ATTRIBUTES.key(color_code) end |
#convert_html_element(el, opts) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/bk/annotation_formatter/markdown.rb', line 2 def convert_html_element(el, opts) if el.value == "span" color = color_from_span_class(el.attr["class"]) return super unless color pastel.send(color, inner(el, opts)) else super end end |
#pastel ⇒ Object
22 23 24 |
# File 'lib/bk/annotation_formatter/markdown.rb', line 22 def pastel @pastel ||= Pastel.new end |