-
Notifications
You must be signed in to change notification settings - Fork 887
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
Span rules + br can break commonmark standard #405
Comments
Added a pull request that demonstrates this and other corner cases: |
Can we avoid it somehow??? 1.Zero width space and/or Non-breaking space:
Is there any way to filter out (remove) html with zero visual content?
2.Line break which breaks markdown's markup:
Is there any way to filter out (remove) all line breaks that precedes the closing tag?
|
Good to hear that, @zombiecalypse. Maybe this single exception can be added to be handled by My code uses |
Implementation here:
turndown/src/commonmark-rules.js
Line 209 in 4499b5c
Reproducing example:
turndown("<em>foo<br/></em>") == "_foo \n_"
https://spec.commonmark.org/0.30/#emphasis-and-strong-emphasis
and
This means that
commonmark2html("_foo \n_") = "<p>_foo<br/>_</p>"
, i.e. the<em>
is lost.The same is true for the other possible span delimiters (
*
,__
,**
) and on a leading<br/>
in a span element.As far as I can tell only
<br/>
is affected. While<em><p>foo<p></em>bar
and similar abominations do trip up the context free replacement, they are fortunately not valid htmlThe text was updated successfully, but these errors were encountered: