Module: GLFMMarkdown
- Defined in:
- lib/glfm_markdown.rb,
lib/glfm_markdown/version.rb
Constant Summary collapse
- GLFM_DEFAULT_OPTIONS =
{ autolink: true, escaped_char_spans: false, footnotes: true, full_info_string: true, gfm_quirks: true, github_pre_lang: false, hardbreaks: false, math_code: false, math_dollars: false, multiline_block_quotes: true, relaxed_autolinks: false, sourcepos: true, experimental_inline_sourcepos: true, smart: false, strikethrough: true, table: true, tagfilter: false, tasklist: true, unsafe: true, debug: false }.freeze
- VERSION =
'0.0.21'
Class Method Summary collapse
Class Method Details
.to_html(markdown, options: {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/glfm_markdown.rb', line 34 def to_html(markdown, options: {}) raise TypeError, 'markdown must be a String' unless markdown.is_a?(String) raise TypeError, 'markdown must be UTF-8 encoded' unless markdown.encoding.name == "UTF-8" raise TypeError, 'options must be a Hash' unless .is_a?(Hash) = [:glfm] ? GLFM_DEFAULT_OPTIONS : {} # if you need to modify `options`, use `.merge` as `options` could be frozen = .merge(unsafe: true) if [:tagfilter] render_to_html_rs(markdown, .merge()) end |