instance method
node_to_markdown
Ruby on Rails edge
Since edgeSignature
node_to_markdown(node)
Converts a Nokogiri HTML node into a Markdown string.
node = Nokogiri::HTML4.fragment("<p>Hello <strong>world</strong></p>")
MarkdownConversion.node_to_markdown(node) # => "Hello **world**"
NOTE: text inside ‘<action-text-markdown>` elements is emitted without escaping, so this method is not safe for untrusted content. Convert user-supplied markup through ActionText::Content, which strips those elements while canonicalizing.
Parameters
-
nodereq
Source
# File actiontext/lib/action_text/markdown_conversion.rb, line 31
def node_to_markdown(node)
BottomUpReducer.new(node).reduce do |n, child_values|
markdown_for_node(n, child_values)
end.strip
end
Defined in actiontext/lib/action_text/markdown_conversion.rb line 31
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionText::MarkdownConversion