Module: CommonMarker::Rouge

Defined in:
lib/common_marker/rouge.rb

Overview

rouge

Class Method Summary collapse

Class Method Details

.render_doc(text, cmark_options = :DEFAULT, extensions = [], **cmr_options) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/common_marker/rouge.rb', line 9

def render_doc(text, cmark_options = :DEFAULT, extensions = [], **cmr_options)
  cmark = cmr_options[:cmark_class] || ::CommonMarker

  ast = cmark.render_doc(text, cmark_options, extensions)
  process_ast(ast, cmr_options)
  ast
end

.render_html(text, cmark_options = :DEFAULT, render_options = :UNSAFE, extensions = [], **cmr_options) ⇒ Object



17
18
19
20
21
# File 'lib/common_marker/rouge.rb', line 17

def render_html(text, cmark_options = :DEFAULT, render_options = :UNSAFE, extensions = [], **cmr_options)
  doc = render_doc(text, cmark_options, extensions, **cmr_options)
  CommonMarker::CustomHtmlRenderer.new(options: render_options, extensions: extensions).render(doc)
  # doc.to_html(render_options)
end