-
Notifications
You must be signed in to change notification settings - Fork 591
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] Add YAML frontmatter highlighting #2339
[Markdown] Add YAML frontmatter highlighting #2339
Conversation
Because this may only match at the very beginning of the file, it cannot be tested. I tried. Closes sublimehq#1783.
|
There are a couple tests regarding the |
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'd propose something like this...
contexts:
main:
- match: ---\n
scope: meta.frontmatter.markdown punctuation.section.frontmatter.begin.markdown
embed: scope:source.yaml
embed_scope: meta.frontmatter.markdown source.yaml.embedded.markdown
escape: ^---(?=\s)
escape_captures:
0: meta.frontmatter.markdown punctuation.section.frontmatter.end.markdown
- match: ''
set: markdown
markdown:
...
main: | ||
- include: file-start |
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.
Not sure if it is really worth adding a named context for just one match rule.
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.
The name of the context helps convey the semantic meaning of the match, imo, so I left that in.
- Better supports embedding by not anchoring to `^`. - Since some newish release we can also set out of the main context.
One the test failure is fixed, this should be good to merge |
LGTM, thanks! |
@@ -24,5 +25,5 @@ contexts: | |||
scope: string.unquoted.multimarkdown | |||
- match: '' | |||
push: | |||
- meta_scope: meta.content.multimarkdown | |||
- include: scope:text.html.markdown | |||
- - meta_scope: meta.content.multimarkdown |
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.
Is that style a new feature in version 2?
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.
No, that was possible before.
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.
Yeah, but Will told Thom not to do it for complicated stuff.
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 know about chaining anonymous contexts via - - ...
. I did not expect anonymous contexts with only a meta_scope
derective to be valid.
* [Markdown] Add YAML frontmatter highlighting Because this may only match at the very beginning of the file, it cannot be tested. I tried. Closes sublimehq#1783. * [Markdown] Add test for normal `---` token * [Markdown] Add `meta.formatter.markdown` scope - Better supports embedding by not anchoring to `^`. - Since some newish release we can also set out of the main context. * [Markdown] Fix Multimarkdown tests by embedding * [Markdown] Replace embed with multi-push
* [Markdown] Add YAML frontmatter highlighting Because this may only match at the very beginning of the file, it cannot be tested. I tried. Closes sublimehq#1783. * [Markdown] Add test for normal `---` token * [Markdown] Add `meta.formatter.markdown` scope - Better supports embedding by not anchoring to `^`. - Since some newish release we can also set out of the main context. * [Markdown] Fix Multimarkdown tests by embedding * [Markdown] Replace embed with multi-push
Because this may only match at the very beginning of the file, it cannot be tested. I tried.
Closes #1783.