Class: TextUtils::Markdown
- Defined in:
- lib/text_utils/markdown.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
[:autolink, :lax_htmlblock, :smart, :tables, :xhtml, :fenced_code, :strikethrough, :hard_wrap]
Instance Method Summary collapse
- #call(data, env) ⇒ Object
-
#initialize(processor = nil, options = nil) ⇒ Markdown
constructor
A new instance of Markdown.
Constructor Details
#initialize(processor = nil, options = nil) ⇒ Markdown
Returns a new instance of Markdown.
4 5 6 7 |
# File 'lib/text_utils/markdown.rb', line 4 def initialize processor = nil, = nil super processor @options = || DEFAULT_OPTIONS end |
Instance Method Details
#call(data, env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/text_utils/markdown.rb', line 9 def call data, env if env[:format] == :markdown require 'redcarpet' data = fix_new_lines data do |data| markdown = Redcarpet.new(data, *@options) markdown.to_html end end call_next data, env end |