Module: WhatTheGem::I::Kramdowns
Instance Method Summary collapse
-
#el2md(el) ⇒ Object
Somehow there is no saner methods for converting parsed element back to source :shrug:.
- #elements(source) ⇒ Object
Instance Method Details
#el2md(el) ⇒ Object
Somehow there is no saner methods for converting parsed element back to source :shrug:
30 31 32 33 34 |
# File 'lib/whatthegem/i.rb', line 30 def el2md(el) el.[:encoding] = 'UTF-8' el.attr.replace({}) # don't render header anchors Kramdown::Converter::Kramdown.convert(el, line_width: 1000).first end |
#elements(source) ⇒ Object
25 26 27 |
# File 'lib/whatthegem/i.rb', line 25 def elements(source) Kramdown::Document.new(source, input: 'GFM').root.children end |