class HTML::Pipeline::KramdownFilter

A filter to compile Markdown contents.

Public Class Methods

new(text, context = nil, result = nil) click to toggle source

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.

Calls superclass method
# File lib/mbrao/rendering_engines/html_pipeline/kramdown_filter.rb, line 18
def initialize(text, context = nil, result = nil)
  super(text, context, result)
  @text = @text.gsub("\r", "")
end

Public Instance Methods

call() click to toggle source

Converts Markdown to HTML using Kramdown and converts into a DocumentFragment.

@return [DocumentFragment] The converted fragment.

# File lib/mbrao/rendering_engines/html_pipeline/kramdown_filter.rb, line 26
def call
  Kramdown::Document.new(@text, @context).to_html
end