Punctuation marks causing Markdown bold display to fail

Per CommonMark, a ** can only close strong emphasis if it’s part of a right-flanking delimiter run. A delimiter preceded by punctuation (.) and followed by a word character (t) is not right-flanking, so it can’t close. markdown-it parses it as literal text. Same rule applies to *, _, and __.

I think there’s not much we can do about this, we’re following the spec, but this showed me we had a bug with the rich editor markdown serializer: if you used the UI to build this situation (**text.**text), it displayed correctly on the rich editor, but cooked as plain-text. This PR addressed this scenario by expelling the punctuation from the marked area, so it becomes text.text (**text**.text).

3 Likes