module Commonmarker
def parse(text, options: Commonmarker::Config::OPTIONS)
options - A {Hash} of render, parse, and extension options to transform the text.
text - A {String} of text
Public: Parses a CommonMark string into an HTML string.
def parse(text, options: Commonmarker::Config::OPTIONS) raise TypeError, "text must be a String; got a #{text.class}!" unless text.is_a?(String) raise TypeError, "text must be UTF-8 encoded; got #{text.encoding}!" unless text.encoding.name == "UTF-8" raise TypeError, "options must be a Hash; got a #{options.class}!" unless options.is_a?(Hash) opts = Config.process_options(options) commonmark_parse(text, options: opts) end
def to_html(text, 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.
text - A {String} of text
Public: Parses a CommonMark string into an HTML string.
def to_html(text, options: Commonmarker::Config::OPTIONS, plugins: Commonmarker::Config::PLUGINS) raise TypeError, "text must be a String; got a #{text.class}!" unless text.is_a?(String) raise TypeError, "text must be UTF-8 encoded; got #{text.encoding}!" unless text.encoding.name == "UTF-8" 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) commonmark_to_html(text, options: opts, plugins: plugins) end