Sha256: 8a35082205090be8f7e614553aa1c8b564b5280bc593de5fc8a20b1d5fdaedae
Contents?: true
Size: 876 Bytes
Versions: 1
Compression:
Stored size: 876 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(context: context, result: result) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
html-pipeline-3.2.0 | lib/html_pipeline/convert_filter/markdown_filter.rb |