highlight.js
highlight.js copied to clipboard
(markdown) List items inside blockquotes/HTML comments aren't highlighted correctly
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:
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:
or this:
* One
* Two
* Three
some text
which gets highlighted like this:
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?
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.
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.