-
Notifications
You must be signed in to change notification settings - Fork 175
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
Support wrapping Markdown with div tags #5
Comments
Please provide a full example:
That being said, I looked into CommonMark compatibility and it would be so much work that it falls outside of this project's ambitions. Making other substantial changes to the parser could also be outside of scope. |
Markdown text<div class="bar">
**Hello**
- Should work as per CommonMark
</div> Current output<div class="bar">
**Hello**
- Should work as per CommonMark
</div> Expected output<div class="bar">
<strong>Hello</strong>
<ul>
<li>Should work as per CommonMark</li>
</ul>
</div>
My feature request is for this small part of CommonMark spec and not the full spec compatibility, as this will allow all the Markdown blocks to be wrapped with div classes. |
OK, my proposal is different from the CommonMark spec in one crucial aspect.. While the CommonMark spec wraps the rendered Markdown HTML in |
As another data point, this is a somewhat common pattern to center align things in a readme on github (badges in particular). An example:
|
This uses a BlackFriday hack for rendering Markdown inside HTML: gomarkdown/markdown#5 This shouldn't happen if BlackFriday respected the CommonMark spec: https://spec.commonmark.org/0.21/#html-blocks
This uses a BlackFriday hack for rendering Markdown inside HTML: gomarkdown/markdown#5 <tag> <tag></tag> **Markdown text** </tag> (The line break is important) BTW, this shouldn't happen if BlackFriday respected the CommonMark spec: https://spec.commonmark.org/0.21/#html-blocks
The same here: https://play.golang.org/p/Th2EDlOGmSX |
As a work around: https://play.golang.org/p/caH-GSovGRZ
|
This ugly stuff works for me: https://play.golang.org/p/JTE8bVfhXXv |
Pandoc allows something like this:
which becomes something like:
One can argue if the triple colons ( |
To set the expectations: probably won't happen as it most likely would require a big change to the parser. Currently those 2 We would probably need to add If anyone wants to give it a go, I'll look at the PR but I'm unlikely to work on such big (?) change. |
Hi @kjk , thanks for taking the time to consider this idea and to assess its feasibility, too bad it's so difficult to implement... |
Hello,
By default we can wrap Markdown code with inline tags.. so
<span class="foo">_italics_</span>
will render the internal Markdown.But it does not work when wrapped with
<div>
, and that's a major limitation! That disallows us from setting specific classes for Markdown tables, etc.The good thing is that div wrapping is allowed in CommonMark spec: russross/blackfriday#404 (comment)
As per http://spec.commonmark.org/0.18/#example-108, this is a valid way of div-wrapping Markdown text that should be rendered:
The newlines after
<div>
and before</div>
are needed.Is this something that could be added?
This sort of works with Blackfriday but because of an undocumented ugly hack.. example.. it would be nice to get rid of those empty divs in the hack.
Many thanks.
The text was updated successfully, but these errors were encountered: