Closed abhangs closed 2 years ago
You are using commonmarker
, which turns out not to support HTML tags in Markdown by default, for safety reasons. You can change this by overriding the settings for commonmarker
in gollum's config.rb
by adding:
GitHub::Markup::Markdown::MARKDOWN_GEMS['commonmarker'] = proc { |content, options: {}|
CommonMarker.render_html(content, [:UNSAFE, :GITHUB_PRE_LANG], [:tagfilter, :autolink, :table, :strikethrough])
}
This should be ok from a safety perspective as gollum implements its own sanitization.
Annoyingly, when using the default kramdown
renderer (which in @abhangs's setup can be achieved by simply gem uninstall commonmarker
), the <default>
tag is present, but the markdown it contains is not rendered. That is, kramdown seems to ignore Markdown in HTML tags.
The workaround for kramdown
is to do this:
<details markdown="1">
<summary>click here</summary>
Test
1. this
1. should
1. be
1. a folded
1. list
</details>
Notice the markdown="1"
in the <details>
tag. Also note that the summary
tag should not be indented.
Since we can support this feature with this minimal workaround on kramdown, I propose we close this issue. @abhangs would you perhaps have a moment to type something about this in the wiki?
Thank you @dometto Your instructions worked. I have edited the wiki as well: https://github.com/gollum/gollum/wiki#HTML-Elements
if you're looking for up-to-date config.rb
require 'commonmarker'
GitHub::Markup::Markdown::MARKDOWN_GEMS['commonmarker'] = proc { |content, options: {}|
Commonmarker.to_html(content, options: {
render: { unsafe: true }
})
}
Describe the bug
<details>
tag does not work or not rendered as expected.To Reproduce I put the following in one of my markdown files for testing purposes
Expected behavior The tag should be rendered as a collapsible section, just like on this Github website:
click here
1. this 1. should 1. be 1. a folded 1. listScreenshots
The input:
How it is rendered:
Environment Info