Class: GfmToBlockkit::Converters::Heading
- Defined in:
- lib/gfm_to_blockkit/converters/heading.rb
Constant Summary collapse
- MAX_HEADER_LENGTH =
150
Instance Method Summary collapse
Methods inherited from Base
converter_for, handles, #initialize, #render_child_as_elements
Constructor Details
This class inherits a constructor from GfmToBlockkit::Converters::Base
Instance Method Details
#convert(node) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/gfm_to_blockkit/converters/heading.rb', line 10 def convert(node) text = plain_text_from(node).strip return [] if text.empty? text = text[0, MAX_HEADER_LENGTH - 1] + "\u2026" if text.length > MAX_HEADER_LENGTH [{ type: "header", text: {type: "plain_text", text: text, emoji: true} }] end |