Punctuation marks causing Markdown bold display to fail

Hello. Okay
hello. yes

As shown above, bold formatting is not working.

Hello. Okay

Hello. Okay

hello. Okay

Eh? No matter if I’m using ** or B-button I get bolded text. Same with markdown editor and RTE.

**Hello. Okay.**hello

There is punctuation before the final **, followed immediately by text. Give it a try.

The following format will not work
**+text+punctuation+**+text

hello. Okey. some text

And

hello okey without punctuation

But if we don’t use space after punctuation and ending ** that happens:

**hello okey.**text
**hello okey.**text

Versus

**hello okey.** text
hello okey. text

I don’t know if this is a bug or a feature of markdown, or something.

I believe the problem is not from punctuation before the asterisks, but rather text immediately after the asterisks with no space.

with punctuation. space text
**with punctuation.**no space text

**with punctuation.** space text
**with punctuation.**no space text

I do. It’s markdown’s default behavior. :slight_smile:

2 Likes

It’s a known problem in Markdown, and can’t be fixed unless you can change the Markdown parser

And my workaround is to use <span></span>

**是的。**<span></span>对的。 是的。对的。

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).

2 Likes

Can still reproduce this bug, the punctuation is only moved out after I switch to Markdown editor or post.

Test with rich editor: text.text

the punctuation is still initially bolded