Class: Banzai::Filter::MarkdownEngines::CommonMark

Inherits:
Object
  • Object
show all
Defined in:
lib/banzai/filter/markdown_engines/common_mark.rb

Constant Summary collapse

EXTENSIONS =
[
  :autolink,      # provides support for automatically converting URLs to anchor tags.
  :strikethrough, # provides support for strikethroughs.
  :table          # provides support for tables.
].freeze
PARSE_OPTIONS =
[
  :FOOTNOTES,                  # parse footnotes.
  :STRIKETHROUGH_DOUBLE_TILDE, # parse strikethroughs by double tildes (as redcarpet does).
  :VALIDATE_UTF8               # replace illegal sequences with the replacement character U+FFFD.
].freeze
RENDER_OPTIONS =
[
  :GITHUB_PRE_LANG,  # use GitHub-style <pre lang> for fenced code blocks.
  :FOOTNOTES,        # render footnotes.
  :FULL_INFO_STRING, # include full info strings of code blocks in separate attribute.
  :UNSAFE            # allow raw/custom HTML and unsafe links.
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ CommonMark

Returns a new instance of CommonMark.


32
33
34
# File 'lib/banzai/filter/markdown_engines/common_mark.rb', line 32

def initialize(context)
  @context = context
end

Instance Method Details

#render(text) ⇒ Object


36
37
38
# File 'lib/banzai/filter/markdown_engines/common_mark.rb', line 36

def render(text)
  CommonMarker.render_html(text, render_options, EXTENSIONS)
end