class Commonmarker::Node
def each
def each return enum_for(:each) unless block_given? child = first_child while child next_child = child.next_sibling yield child child = next_child end end
def to_commonmark(options: Commonmarker::Config::OPTIONS, plugins: Commonmarker::Config::PLUGINS)
plugins - A {Hash} of additional plugins.
options - A {Symbol} or {Array of Symbol}s indicating the render options
Public: Convert the node to a CommonMark string.
def to_commonmark(options: Commonmarker::Config::OPTIONS, plugins: Commonmarker::Config::PLUGINS) raise TypeError, "options must be a Hash; got a #{options.class}!" unless options.is_a?(Hash) opts = Config.process_options(options) plugins = Config.process_plugins(plugins) node_to_commonmark(options: opts, plugins: plugins).force_encoding("utf-8") end
def to_html(options: Commonmarker::Config::OPTIONS, plugins: Commonmarker::Config::PLUGINS)
plugins - A {Hash} of additional plugins.
options - A {Hash} of render, parse, and extension options to transform the text.
Public: Converts a node to an HTML string.
def to_html(options: Commonmarker::Config::OPTIONS, plugins: Commonmarker::Config::PLUGINS) raise TypeError, "options must be a Hash; got a #{options.class}!" unless options.is_a?(Hash) opts = Config.process_options(options) plugins = Config.process_plugins(plugins) node_to_html(options: opts, plugins: plugins).force_encoding("utf-8") end
def walk(&block)
Public: An iterator that "walks the tree," descending into children recursively.
def walk(&block) return enum_for(:walk) unless block yield self each do |child| child.walk(&block) end end