Sha256: 3582e382c87199d2b526414b91db30e72a1062f4fb71eda4fb199e132e07b0ed
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 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 https://choosealicense.com/licenses/mit. # # 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.2 | lib/mbrao/rendering_engines/html_pipeline/kramdown_filter.rb |
mbrao-1.6.1 | lib/mbrao/rendering_engines/html_pipeline/kramdown_filter.rb |