-
-
Notifications
You must be signed in to change notification settings - Fork 39
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.@md_str
breaks syntax highlighting
#244
Comments
This seems like it still is an issue and may need to be reopened, example here. |
Yeah, turns out I only committed the changelog entry in that PR. Should actually be fixed with #252. |
Hahaha, shame on me for believing the release notes ;) |
PR is here for reference: github-linguist/linguist#5638 |
Pro-tip: When embedding third-party grammars (particularly those you have no control over), it's always prudent to use a fixed-size pattern rather than a name: "string.quoted.double.julia"
match: '(")((?:[^"\\\\]|\\\\.)*+)(")'
captures:
1: name: "punctuation.definition.string.begin.julia"
2: name: "text.embedded.md", patterns: [include: "text.md"]
3: name: "punctuation.definition.string.end.julia" … instead of this: name: "string.quoted.double.julia"
begin: '"'
end: '"'
beginCaptures: 0: name: "punctuation.definition.string.begin.julia"
endCaptures: 0: name: "punctuation.definition.string.end.julia"
contentName: "text.embedded.md"
patterns: [include: "text.md"] I call this technique "clamping", because patterns that would otherwise threaten to spill past the |
Thanks, that's a great solution. Do you have any ideas for multi-line strings, short of removing those rules? |
Yes, though it's a little trickier: name: "string.quoted.double.julia"
begin: '"'
end: '"'
beginCaptures: 0: name: "punctuation.definition.string.begin.julia"
endCaptures: 0: name: "punctuation.definition.string.end.julia"
patterns: [{
name: "text.embedded.md"
match: '(?:[^"\\\\]|\\\\.)*+'
captures:
0: patterns: [include: "text.md"]
}] |
Every other string macro I've tried is fine, but
md"text"
breaks the syntax highlighting for the rest of the document.The text was updated successfully, but these errors were encountered: