Class: Banzai::Filter::MarkdownEngines::Cmark

Inherits:
Base
  • Object
show all
Defined in:
lib/banzai/filter/markdown_engines/cmark.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
RENDER_OPTIONS_SOURCEPOS =
RENDER_OPTIONS + [:SOURCEPOS].freeze

Instance Attribute Summary

Attributes inherited from Base

#context

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Banzai::Filter::MarkdownEngines::Base

Instance Method Details

#render(text) ⇒ Object



37
38
39
# File 'lib/banzai/filter/markdown_engines/cmark.rb', line 37

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