-
Notifications
You must be signed in to change notification settings - Fork 588
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] support lists in blockquotes, code fences, multiline inline code and multiline emphasis #806
Conversation
due to the way the contexts are pushed and popped, `\G` is not necessary, nor are the negative lookaheads - if none of the matches match, pop out the context
e83517a
to
4aac501
Compare
I've got this to the state where the only incompatible regex patterns are two |
Markdown/Markdown.sublime-syntax
Outdated
- match: '\1' | ||
scope: punctuation.definition.raw.end.markdown | ||
pop: true | ||
- match: '{{backticks}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest this instead:
contexts:
raw:
- match: (`+)
scope: punctuation.definition.raw.begin.markdown
push:
- meta_scope: markup.raw.inline.markdown
- match: \1(?!`)
scope: punctuation.definition.raw.end.markdown
pop: true
- match: '`+'
- match: ^\s*$\n?
scope: invalid.illegal.non-terminated.raw.markdown
pop: true
This allows multi-line inline raw sequences again and isn't explicit about the number of backticks allowed, which is arbitrary. I don't know if this actually represents how markdown parsers work, but some testing here on github seemed to confirm this behavior.
Should also exit on empty lines. See:
test `test
test`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FichteFoll thanks, I have just pushed a new commit with your proposal :)
I've done some testing at http://spec.commonmark.org/dingus/ and made the backtick handling more consistent with how that works. This includes support for code fences (though it doesn't highlight the language contained inside the fence yet, I'll leave that for another PR, as I wonder if it would give us more |
Performance comparison (24 KiB syntax test file): This PR:
Before this PR:
|
(previously they weren't allowed in lists, and they only received a meta scope so couldn't really be targeted by color schemes)
useful for comments when people don't want to use HTML comments - see SublimeText-Markdown/MarkdownEditing#409
Performance update & comparisons against some Markdown syntaxes on Package Control, for the syntax test file in this PR, which is now 40 KiB:
|
Thank you very much for all of this work! |
This PR simplifies a few contexts, removes a few incompatible regexs (mainly
\G
) and adds support for lists in blockquotes, plus includes a few more tests.