Class: MdReader::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/md_reader.rb

Constant Summary collapse

MARKDOWN_EXTENSIONS =
{
  fenced_code_blocks: true,
  tables: true,
  autolink: true,
  strikethrough: true,
  superscript: true,
  highlight: true,
  footnotes: true,
  no_intra_emphasis: true
}.freeze

Instance Method Summary collapse

Instance Method Details

#call(content, title = "Document") ⇒ Object



19
20
21
22
23
24
# File 'lib/md_reader.rb', line 19

def call(content, title = "Document")
  renderer = Redcarpet::Render::HTML.new(hard_wrap: true, with_toc_data: true)
  markdown = Redcarpet::Markdown.new(renderer, MARKDOWN_EXTENSIONS)
  body = markdown.render(content)
  html_template(body, title)
end