Module: StringMarkdown

Included in:
String
Defined in:
lib/string_markdown.rb,
lib/string_markdown/version.rb

Defined Under Namespace

Classes: PygmentizeHTML

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#to_mdObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/string_markdown.rb', line 7

def to_md
  html_render = StringMarkdown::PygmentizeHTML.new hard_wrap: true, filter_html: true
  markdown = Redcarpet::Markdown.new html_render, autolink: true, fenced_code_blocks: true, space_after_headers: true
  begin
    text = self
    return markdown.render text
  rescue => e
    return e.message
    text
  end
end