Module: GLFMMarkdown
- Defined in:
- lib/gitlab-glfm-markdown.rb,
lib/gitlab_glfm_markdown/version.rb
Constant Summary collapse
- GLFM_DEFAULT_OPTIONS =
{ autolink: true, cjk_friendly_emphasis: true, escaped_char_spans: false, footnotes: true, full_info_string: true, gfm_quirks: true, github_pre_lang: false, hardbreaks: false, inapplicable_tasks: false, math_code: false, math_dollars: false, multiline_block_quotes: true, relaxed_autolinks: false, sourcepos: true, smart: false, strikethrough: true, table: true, tagfilter: false, tasklist: true, tasklist_classes: true, unsafe: true }.freeze
- VERSION =
'0.0.40'
Class Method Summary collapse
- .escape_commonmark_inline(text) ⇒ Object
- .escape_commonmark_link_destination(url) ⇒ Object
- .to_html(markdown, options: {}) ⇒ Object
Class Method Details
.escape_commonmark_inline(text) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/gitlab-glfm-markdown.rb', line 47 def escape_commonmark_inline(text) raise TypeError, 'text must be a String' unless text.is_a?(String) raise TypeError, 'text must be UTF-8 encoded' unless text.encoding == Encoding::UTF_8 escape_commonmark_inline_rs(text) end |
.escape_commonmark_link_destination(url) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/gitlab-glfm-markdown.rb', line 54 def escape_commonmark_link_destination(url) raise TypeError, 'url must be a String' unless url.is_a?(String) raise TypeError, 'url must be UTF-8 encoded' unless url.encoding == Encoding::UTF_8 escape_commonmark_link_destination_rs(url) end |
.to_html(markdown, options: {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gitlab-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 == Encoding::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 |