Class: GfmToBlockkit::Converters::FootnoteDefinition
- Defined in:
- lib/gfm_to_blockkit/converters/footnote_definition.rb
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
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gfm_to_blockkit/converters/footnote_definition.rb', line 8 def convert(node) html = begin node.to_html rescue "" end label = html[/id="fn-(\w+)"/, 1] || "?" content_parts = [] node.each do |child| if child.type == :paragraph content_parts << mrkdwn_renderer.render(child) end end content = content_parts.join(" ") return [] if content.strip.empty? [{ type: "context", elements: [{ type: "mrkdwn", text: "[#{label}] #{content}" }] }] end |