Sha256: 55be8a62cc0a5381bc736697b4572de682581f07826e60a0bffc367bf89b40cb
Contents?: true
Size: 842 Bytes
Versions: 2
Compression:
Stored size: 842 Bytes
Contents
# frozen_string_literal: true HTMLPipeline.require_dependency("commonmarker", "MarkdownFilter") class HTMLPipeline class ConvertFilter < Filter # HTML Filter that converts Markdown text into HTML. # # Context options: # :markdown[:parse] => Commonmarker parse options # :markdown[:render] => Commonmarker render options # :markdown[:extensions] => Commonmarker extensions options class MarkdownFilter < ConvertFilter def initialize(context: {}, result: {}) super end # Convert Commonmark to HTML using the best available implementation. def call(text, context: @context) options = context.fetch(:markdown, {}) plugins = options.fetch(:plugins, {}) Commonmarker.to_html(text, options: options, plugins: plugins).rstrip! end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
html-pipeline-3.2.2 | lib/html_pipeline/convert_filter/markdown_filter.rb |
html-pipeline-3.2.1 | lib/html_pipeline/convert_filter/markdown_filter.rb |