Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default CommonMarker options? #419

Open
dometto opened this issue May 16, 2022 · 0 comments
Open

Default CommonMarker options? #419

dometto opened this issue May 16, 2022 · 0 comments

Comments

@dometto
Copy link
Member

dometto commented May 16, 2022

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: github/markup#1543

If this is merged, it woud allow us to refactor the way we override options for the markdown rendering gems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant