mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-11 05:44:45 +00:00
String not processed as markdown if it starts with div #579
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @omer-iqbal on GitHub (Dec 4, 2022).
If markdown starts with
<div>, e.g.:<div>Hello *world*Then
Markdown.ToHtml()does not process it, i.e. the same string is returned.However, if the
<div>tag is replaced with another one, say<span>or a custom one like<a>, then markdown is processed correctly. The result would be<p><a>Hello <em>world</em>.@xoofx commented on GitHub (Dec 4, 2022):
This is a HTML block as per the CommonMark spec here,
<div>is a start condition for a HTML block. See also that all CommonMark implementations are behaving similarly.@omer-iqbal commented on GitHub (Dec 4, 2022):
CommonMark spec section 6.6 confused me actually, e.g. examples 612 onwards. I spent quite some time trying out different md texts and comparing with the spec before opening this issue. Thanks for the clarification. Now it's obvious and I feel bad for opening this issue. :(
@xoofx commented on GitHub (Dec 4, 2022):
Don't feel bad. The spec is quite complicated when you go into corner cases like this. But I'm happy that there is a spec because that would be a nightmare without it for a maintainer! 😅
@omer-iqbal commented on GitHub (Dec 4, 2022):
I had looked at md a long time back and didn't find a good parser, so I did some minimal custom (non md) parsing for my project. I am beginning to love md in my project now, thanks to markdig and you're right, the spec has made a huge difference. I do have some custom formatting needs so I will be exploring writing extensions as well.