Hi,
With CommonMark, is there an easy way to remove the stuff you don’t need? Here for instance, using Kramdown, I’m deleting all parsers except paragraph
, blank_line
, line_break
and link
:
config/initializers/my_kramdown.rb
:
require 'kramdown/parser/kramdown'
module Kramdown
module Parser
class CustomKramdown < Kramdown::Parser::Kramdown
# https://github.com/gettalong/kramdown/blob/master/lib/kramdown/parser/kramdown.rb#L75
def initialize(source, options)
super
[
# :paragraph,
# :blank_line,
:list,
:definition_list,
:codeblock,
:codeblock_fenced,
:blockquote,
:atx_header,
:horizontal_rule,
:block_html,
:setext_header,
:table,
:footnote_definition,
:link_definition,
:abbrev_definition,
:block_extensions,
:block_math,
:eob_marker
].each do |parser|
@block_parsers.delete(parser)
end
[
# :line_break,
# :link,
:emphasis,
:codespan,
:autolink,
:span_html,
:footnote_marker,
:smart_quotes,
:inline_math,
:span_extensions,
:html_entity,
:typographic_syms,
:escaped_chars
].each do |parser|
@span_parsers.delete(parser)
end
end
end
end
end