Class: Markerb::Markdown

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

Class Method Summary collapse

Class Method Details

.to_html(compiled_source) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/markerb/markdown.rb', line 6

def self.to_html(compiled_source)
  if defined?(Redcarpet)
    Markerb.renderer ||= Redcarpet::Render::HTML
    Redcarpet::Markdown.new(Markerb.renderer, Markerb.processing_options).render(compiled_source)
  elsif defined?(Kramdown)
    Kramdown::Document.new(compiled_source, Markerb.processing_options).to_html
  else
    raise StandardError, "Markdown processor unavailable, please add either Redcarpet or Kramdown to your project"
  end
end