dart-lang / markdown

A Dart markdown library
https://pub.dev/packages/markdown
BSD 3-Clause "New" or "Revised" License
443 stars 201 forks source link

Syntax nesting is not supported #483

Closed fuyunmanbu closed 1 year ago

fuyunmanbu commented 1 year ago

such as ~~**hello**~~ Cannot be recognized at the same time

srawlins commented 1 year ago

Do you see this with various syntaxes, or just strikethrough (~~)?

fuyunmanbu commented 1 year ago

various syntaxes,The effect of syntax nesting together

fuyunmanbu commented 1 year ago

Snip20221104_10 Snip20221104_10

fuyunmanbu commented 1 year ago

Snip20221104_9

fuyunmanbu commented 1 year ago

This effect works at the same time

srawlins commented 1 year ago

All of those examples have strikethrough. I imagine it only affects strikethrough.

chenzhiguang commented 1 year ago

I will fix that

chenzhiguang commented 1 year ago

@fuyunmanbu I got what you mean. 🙂 The markdown package itself has no problem to parse the nesting strikethrough and strong emphasis, for example

markdownToHtml('~~**hello**~~', extensionSet: ExtensionSet.gitHubFlavored)

will output:

<p><del><strong>hello</strong></del></p>

You might need to report it here if you are using flutter_markdown.

fuyunmanbu commented 1 year ago

I found the problem after the test. I can support English, but not Chinese. Can you solve this problem?

fuyunmanbu commented 1 year ago

Snip20221104_1 Snip20221104_2

fuyunmanbu commented 1 year ago

Snip20221104_4 Snip20221104_5

fuyunmanbu commented 1 year ago

I seem to have found the problem. There should be no content around

fuyunmanbu commented 1 year ago

Snip20221104_6 It's not about language

chenzhiguang commented 1 year ago

@fuyunmanbu Got it, thanks!

Then it is the expected behavior. Our StrikethroughSyntax follows the rules of CommanMark delimiter run, it means if a left ~~ is followed by a Unicode punctuation character it must be preceded by a Unicode whitespace or a Unicode punctuation character.

So these strikethroughs are valid:

Hello ~~**Markdown**~~!
Hello:~~**Markdown**~~!

But not this one:

Hello~~**Markdown**~~!
fuyunmanbu commented 1 year ago

Okay. Thank you very much.