Sha256: 3587fe14bf162748a3af2fdafc1e24b136dedb9fb56f0b78964d3f2ec40fc93f
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# encoding: utf-8 # # This file is part of the mbrao gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>. # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php. # # Main module of the [html-pipeline](https://github.com/jch/html-pipeline) gem. module HTML # A [html-pipeline](https://github.com/jch/html-pipeline) gem Pipeline. class Pipeline # A filter to compile Markdown contents. class KramdownFilter < TextFilter # Creates a new filter. # # @param text [String] The string to convert. # @param context [Hash] The context of the conversion. # @param result [Hash] A result hash. def initialize(text, context = nil, result = nil) super(text, context, result) @text = @text.gsub("\r", "") end # Converts Markdown to HTML using Kramdown and converts into a DocumentFragment. # # @return [DocumentFragment] The converted fragment. def call Kramdown::Document.new(@text, @context).to_html end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mbrao-1.6.0 | lib/mbrao/rendering_engines/html_pipeline/kramdown_filter.rb |
mbrao-1.5.0 | lib/mbrao/rendering_engines/html_pipeline/kramdown_filter.rb |