-
Notifications
You must be signed in to change notification settings - Fork 141
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
Inline HTML support with <details> and <summary> in Github flavored markdown #163
Comments
Real-life example: Same README on different platforms |
composer/packagist#974 has fixed the problem displaying the HTML tags |
As reported in composer/packagist#978, @Seldaek pointed out it is likely to be a problem in the markdown library. Quote:
|
See http://johnmacfarlane.net/babelmark2/?normalize=1&text=%3Cdetails%3E%3Csummary%3ESome+PHP+example+(collapsed)%3C%2Fsummary%3E%0A%0A%60%60%60php%0A%3C%3Fphp%0A%0A%2F%2F+this+is+a+comment%0Aecho+%22hello+world%22%3B%0A%0A%3F%3E%0A%60%60%60%0A%0A%3C%2Fdetails%3E for a comparison of the different markdown parsers for that input. |
This is expected because markdown is not parsed inside HTML blocks.
As github is doing it we might add that feature to the GithubMarkdown class. Btw, I was not aware that packagist is using this library :) |
@cebe CommonMark (which GFM is based on now) defines that it is processed if there are empty lines between the HTML markup and the Markdown markup (which probably means it does not require balanced tags in the HTML blocks, and so the empty line makes the structure be See http://johnmacfarlane.net/babelmark2/?normalize=1&text=%3Cdetails%3E%3Csummary%3ESome+PHP+example+(collapsed)%3C%2Fsummary%3E%0A%60%60%60php%0A%3C%3Fphp%0A%0A%2F%2F+this+is+a+comment%0Aecho+%22hello+world%22%3B%0A%0A%3F%3E%0A%60%60%60%0A%3C%2Fdetails%3E for the similar input without the empty lines. commonmark.js will not parse the codeblock anymore in that case. |
<details> and <summary> are tags introduced in HTML5 as a way to enclose collapsible / expandable widgets. Both Github and Gitlab support using them as inline HTML. And they are parsed and displayed properly. Moreover, markdown tags within them are parsed correctly.
People uses them to enclose less important information, such as advanced examples. And by using them, the display of README.md are much easier to read.
Please check the below example. This library does not give the same result parsing the code the same way Github does:
Example
Markdown
Parsed result on Github
Some PHP example (expanded)
Some PHP example (collapsed)
The text was updated successfully, but these errors were encountered: