strange output for simple string #436

Closed
opened 2026-01-29 14:36:38 +00:00 by claunia · 4 comments
Owner

Originally created by @schmitch on GitHub (Feb 17, 2021).

hello, currently we have the following markdown string: **C:\\**test\\

we would expect an output of <p><strong>C:\</strong>test\ unfortunatly we get the following <p>**C:\**test\</p> , is there a reason why that is the case?

Originally created by @schmitch on GitHub (Feb 17, 2021). hello, currently we have the following markdown string: `**C:\\**test\\` we would expect an output of `<p><strong>C:\</strong>test\` unfortunatly we get the following `<p>**C:\**test\</p>` , is there a reason why that is the case?
claunia added the question label 2026-01-29 14:36:38 +00:00
Author
Owner

@xoofx commented on GitHub (Feb 17, 2021):

Yes, you can see that all CommonMark implementations behave the same here

That's expected as per CommonMark specs for emphasis

A right-flanking delimiter run is a delimiter run that is (1) not preceded by Unicode whitespace, and either (2a) not preceded by a punctuation character, or (2b) preceded by a punctuation character and followed by Unicode whitespace or a punctuation character. For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.

The case here in is that on the right of **C:\\** there is test which is not a whitespace or a punctuation.

@xoofx commented on GitHub (Feb 17, 2021): Yes, you can see that all CommonMark implementations behave the same [here](https://babelmark.github.io/?text=**C%3A%5C%5C**test%5C%5C) That's expected as per [CommonMark specs for emphasis](https://spec.commonmark.org/0.29/#emphasis-and-strong-emphasis) > A right-flanking delimiter run is a delimiter run that is (1) not preceded by Unicode whitespace, and either (2a) not preceded by a punctuation character, or (2b) preceded by a punctuation character and followed by Unicode whitespace or a punctuation character. For purposes of this definition, the beginning and the end of the line count as Unicode whitespace. The case here in is that on the right of `**C:\\**` there is `test` which is not a whitespace or a punctuation.
Author
Owner

@schmitch commented on GitHub (Feb 17, 2021):

so is there a way to additional escape the string to satisfy the requirement without adding whitespace?

Edit: or is the only way something like this:

ToHtml(...).Replace("</strong> ", "</strong>");?

@schmitch commented on GitHub (Feb 17, 2021): so is there a way to additional escape the string to satisfy the requirement without adding whitespace? Edit: or is the only way something like this: `ToHtml(...).Replace("</strong> ", "</strong>");`?
Author
Owner

@xoofx commented on GitHub (Feb 17, 2021):

so is there a way to additional escape the string to satisfy the requirement without adding whitespace?

Nope, as per the spec, punctuation or whitespace.

You would have to change it like that **C:**\\test\\ or write directly HTML inlines <strong>C:\\</strong>test\\

@xoofx commented on GitHub (Feb 17, 2021): > so is there a way to additional escape the string to satisfy the requirement without adding whitespace? Nope, as per the spec, punctuation or whitespace. You would have to change it like that `**C:**\\test\\` or write directly HTML inlines `<strong>C:\\</strong>test\\`
Author
Owner

@schmitch commented on GitHub (Feb 17, 2021):

thanks, I think that helped me!

@schmitch commented on GitHub (Feb 17, 2021): thanks, I think that helped me!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#436