Sha256: 73d7da6efb2c6939594cfdb7aa76e915f1574f34e5d7e5fe7c112baae0aa1946
Contents?: true
Size: 849 Bytes
Versions: 11
Compression:
Stored size: 849 Bytes
Contents
# frozen_string_literal: true HTMLPipeline.require_dependency("commonmarker", "MarkdownFilter") class HTMLPipeline class ConvertFilter # 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) options = @context.fetch(:markdown, {}) plugins = options.fetch(:plugins, {}) Commonmarker.to_html(text, options: options, plugins: plugins).rstrip! end end end end
Version data entries
11 entries across 11 versions & 1 rubygems