Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(markdown) List items inside blockquotes/HTML comments aren't highlighted correctly #3519

Closed
double-beep opened this issue Apr 11, 2022 · 3 comments · Fixed by #3520
Closed
Labels
bug help welcome Could use help from community language

Comments

@double-beep
Copy link

Consider this markdown:

> * One (this point is italic)
> * Two
> * Three

This is italic, and because of a lack of termination (#21), everything after is italic

<!-- * but a comment terminates the italic -->

Regular text

It gets highlighted like this:

incorrect markdown highlighting


It is, however, valid markdown:

  • One (this point is italic)
  • Two
  • Three

This should not be italic

Regular text


Compare with the following markdown:

> - One
> - Two
> - Three

some text

that gets highlighted like this:

correct markdown highlighting

or this:

* One
* Two
* Three

some text

which gets highlighted like this:

correct markdown highlighting

@joshgoebel
Copy link
Member

joshgoebel commented Apr 11, 2022

Thanks for the report!

Hmmm... How does a typical Markdown parser know this isn't the beginning of italics (which can span lines typically, no?)... are the rules for italics different inside quotes? What would this be:

> * One (this point is italic) *
> * Two *
> * Three *

Or this:

> *One (this point is italic)*
> *Two*
> *Three*

Is there a difference?

@double-beep
Copy link
Author

I believe that in lists a space between the -/*/... character and the list content is necessary, while in italic/bold there must be no space between **/__/... and the emphasised content.

The CommonMark specification has more examples than the original MD syntax.

@joshgoebel
Copy link
Member

joshgoebel commented Apr 12, 2022

I think the attached PR fixes the false positive, but I'm not sure how to detect the bullets in blockquotes... we don't have sequencing abilities for nesting so there is no way to match the block quote then say "match a bullet, BUT only if it begins immediately after the quote"...

Look-behind could help here, but we can't do that yet because of lagging Safari support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help welcome Could use help from community language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants