mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
In the Chinese environment, some specific symbols are not parsed correctly at the beginning and the end. #491
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pengqian089 on GitHub (Jan 17, 2022).
Emphasis is placed on displaying certain text that will not be parsed correctly when starting and ending with
《or》.Result:
Expected:
I found that Github is not parsed correctly either.
《李茶的姑妈》
李茶的姑妈
《strong》
strong
Sorry, my English is very poor.
I am still working on my English, but it's getting better.
I use it every day now.
@MihaZupan commented on GitHub (Jan 17, 2022):
It's not so much the
《 》characters, but that emphasis requires a space before it:See babelmark - most CommonMark parsers behave the same way as Markdig
@pengqian089 commented on GitHub (Jan 17, 2022):
Thanks.
Can this be considered a bug?
I can be parsed correctly when I use Typora.
@MihaZupan commented on GitHub (Jan 17, 2022):
It is not a bug - Markdig is behaving according to the CommonMark specification here.
While CommonMark allows intraword emphasis like
foo**bar**baz, it has restrictions when the emphasis is preceded/followed by punctuation.See left-flanking-delimiter-run from the spec.
Note
(2b) followed by a Unicode punctuation character and preceded by Unicode whitespace or a Unicode punctuation character. In your case,《falls under theOpen PunctuationUnicode category, so CommonMark requires that emphasis be preceded by a whitespace character.Similar holds for
》that falls underClose Punctuation. The right-flanking-delimiter-run definition requires that it is followed by either a whitespace / another punctuation character.Following these rules, the following are valid:
But
is not.
Typora may be using a more relaxed definition of Markdown, but isn't compliant to the spec here.
@pengqian089 commented on GitHub (Jan 18, 2022):
Thank you for your reply and answer.
I'll get to work on those characters next.