Class: MarkdownWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/railsbricks/assets/lib/markdown_writer.rb

Overview

Documentation for RedCarpet: github.com/vmg/redcarpet

Class Method Summary collapse

Class Method Details

.to_html(markdown) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/railsbricks/assets/lib/markdown_writer.rb', line 4

def self.to_html(markdown)
  renderer = Redcarpet::Render::HTML.new(filter_html: false,
  no_styles: true,
  no_images: false,
  with_toc_data: false,
  link_attributes: {:target => "_blank"}
  )
  converter = Redcarpet::Markdown.new(renderer)
  output = converter.render(markdown)
end

.update_html(obj) ⇒ Object



15
16
17
# File 'lib/railsbricks/assets/lib/markdown_writer.rb', line 15

def self.update_html(obj)
  obj.content_html = MarkdownWriter.to_html(obj.content_md)
end