Class: HTML::Pipeline::LFMarkdown
- Inherits:
-
Redcarpet::Render::HTML
- Object
- Redcarpet::Render::HTML
- HTML::Pipeline::LFMarkdown
- Defined in:
- lib/html/pipeline/markdown_filter.rb
Overview
LinuxFr Flavored Markdown
Constant Summary collapse
- PARSER_OPTIONS =
{ :no_intra_emphasis => true, :tables => true, :fenced_code_blocks => true, :autolink => true, :strikethrough => true, :superscript => true }
- HTML_OPTIONS =
{ :filter_html => true, :no_styles => true, :hard_wrap => true, :xhtml => true }
Instance Attribute Summary collapse
-
#image_class ⇒ Object
Returns the value of attribute image_class.
Instance Method Summary collapse
- #header(text, header_level) ⇒ Object
- #image(link, title, alt_text) ⇒ Object
-
#initialize(extensions = {}) ⇒ LFMarkdown
constructor
A new instance of LFMarkdown.
- #normal_text(text) ⇒ Object
- #strikethrough(text) ⇒ Object
Constructor Details
#initialize(extensions = {}) ⇒ LFMarkdown
Returns a new instance of LFMarkdown.
28 29 30 |
# File 'lib/html/pipeline/markdown_filter.rb', line 28 def initialize(extensions={}) super extensions.merge(HTML_OPTIONS) end |
Instance Attribute Details
#image_class ⇒ Object
Returns the value of attribute image_class.
10 11 12 |
# File 'lib/html/pipeline/markdown_filter.rb', line 10 def image_class @image_class end |
Instance Method Details
#header(text, header_level) ⇒ Object
32 33 34 35 |
# File 'lib/html/pipeline/markdown_filter.rb', line 32 def header(text, header_level) l = header_level + 1 "<h#{l}>#{text}</h#{l}>\n" end |
#image(link, title, alt_text) ⇒ Object
41 42 43 44 |
# File 'lib/html/pipeline/markdown_filter.rb', line 41 def image(link, title, alt_text) return "" if link.blank? ::Image.new(link, title, alt_text).to_html # FIXME end |
#normal_text(text) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/html/pipeline/markdown_filter.rb', line 46 def normal_text(text) text = CGI.escapeHTML(text) text.gsub!('« ', '« ') text.gsub!(/ ([:;»!?])/, ' \1') text.gsub!(' -- ', '—') text.gsub!('...', '…') text end |
#strikethrough(text) ⇒ Object
37 38 39 |
# File 'lib/html/pipeline/markdown_filter.rb', line 37 def strikethrough(text) "<s>#{text}</s>" end |