gollum-lib
gollum-lib copied to clipboard
Default CommonMarker options?
It turns out commonmarker
by default removes HTML tags from markdown for safety. Since we already implement our own sanitization, this seems superfluous: indeed, other renders such as kramdown
already leave HTML elements in by default.
So it may be deisrable to override the commonmarker
defaults and activate its :UNSAFE
option. However, this would require overriding yet another block of code from github-markup
, like here, which would be a bit messy.
Alternatively, we could make use of the fact that github-markup
allows passing in an options hash with commonmarker
settings, e.g.: GitHub::Markup.render("test.md", "hello <bad> world", options: {commonmarker_opts: [:UNSAFE]})
However, since this option does not exist for kramdown
yet, it would mean we would have to manage our defaults for commonmark
and kramdown
in two different ways: overriding the Proc
for the latter, and passing an options hash in our call to GitHub::Markup.render
for the former. I've therefore opened a PR at github-markup
: https://github.com/github/markup/pull/1543
If this is merged, it woud allow us to refactor the way we override options for the markdown rendering gems.