Module: Libertree::Render

Defined in:
lib/libertree/render.rb

Constant Summary collapse

Options =
[ :filter_html,
  :smart,
  :strike,
  :autolink,
  :hard_wrap,
  :notes,
  :codeblock,
  :hashtags,
  :usernames,
  :spoilerblock
]

Class Method Summary collapse

Class Method Details

.to_html_nodeset(s, opts = Options) ⇒ Object



24
25
26
# File 'lib/libertree/render.rb', line 24

def self.to_html_nodeset(s, opts=Options)
  Nokogiri::HTML.fragment(self.to_html_string(s, opts))
end

.to_html_string(s, opts = Options) ⇒ Object



19
20
21
22
# File 'lib/libertree/render.rb', line 19

def self.to_html_string(s, opts=Options)
  return ''  if s.nil? or s.empty?
  Markdown.new( s, *opts ).to_html.force_encoding('utf-8')
end