Module: OrbitalFields::Markdown

Extended by:
ActiveSupport::Concern
Defined in:
lib/orbital_fields/markdown.rb

Defined Under Namespace

Modules: ClassMethods Classes: HTMLwithPygments

Instance Method Summary collapse

Instance Method Details

#markdown(text) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/orbital_fields/markdown.rb', line 29

def markdown(text)
  renderer = HTMLwithPygments.new(hard_wrap: true, filter_html: true)
  options = {
    autolink: true,
    no_intra_emphasis: true,
    fenced_code_blocks: true,
    lax_html_blocks: true,
    strikethrough: true,
    superscript: true
  }
  Redcarpet::Markdown.new(renderer, options).render(text).html_safe
end

#strip_markdown(text) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/orbital_fields/markdown.rb', line 42

def strip_markdown(text)
  renderer = Redcarpet::Render::StripDown.new
  
  redcarpet = Redcarpet::Markdown.new(renderer)
  
  redcarpet.render(text)
end