pulldown-cmark icon indicating copy to clipboard operation
pulldown-cmark copied to clipboard

Emphasis parsing failure around parenthesis

Open Yaossg opened this issue 1 year ago • 1 comments

This bug has existed for a long time. It could be triggered as long as asterisks touch at least one side of parentheses, regardless of English or Chinese ones. Adding a space in-between could resolve it. .

In fact, there are many other cases where emphasis failed. But this one is quite typical and annoying among all.

Source:

**(Test)**WithoutSpace

**(测试)**不加空格

Expected Result: (from pandoc)

<p><strong>(Test)</strong>WithoutSpace</p>
<p><strong>(测试)</strong>不加空格</p>

Actual Result:

<p>**(Test)**WithoutSpace</p>
<p>**(测试)**不加空格</p>

Yaossg avatar Feb 21 '24 09:02 Yaossg

Thanks for the report! I believe this is expected behavior, as pulldown-cmark closely follows CommonMark. In one of these cases, I believe it is the right-flanking delimiter rule which prevents it.

Unfortunately CommonMark does not handle scripts that don't have the same spacing characteristics as many western languages. I see several other people bring up this exact same issue on the forum, but unfortunately from the replies it doesn't look like it is likely to change in the foreseeable future. If pulldown-cmark were to support it, I think it would have to be as an extension.

In the meantime, you'll probably need to add or remove spaces to get it to work, or use HTML tags instead.

ehuss avatar Feb 21 '24 14:02 ehuss