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

Allow wider syntax for magic comments #3249

Merged
merged 4 commits into from Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -12,6 +12,7 @@ Grammars:
- enh(elixir) updated list of keywords (#3212) [Angelika Tyborska][]
- fix(elixir) fixed number detection when numbers start with a zero (#3212) [Angelika Tyborska][]
- fix(ps1) Flag highlighted incorrectly (#3167) [Pankaj Patil][]
- fix(latex) Allow wider syntax for magic comments (#3243) [Benedikt Wilde][]

[Stel Abrego]: https://github.com/stelcodes
[Josh Goebel]: https://github.com/joshgoebel
Expand All @@ -21,6 +22,7 @@ Grammars:
[Konrad Rudolph]: https://github.com/klmr
[tebeco]: https://github.com/tebeco
[Pankaj Patil]: https://github.com/patil2099
[Benedikt Wilde]: https://github.com/schtandard


## Version 11.0.0
Expand Down
2 changes: 1 addition & 1 deletion src/languages/latex.js
Expand Up @@ -105,7 +105,7 @@ export default function(hljs) {
};
const MAGIC_COMMENT = {
className: 'meta',
begin: '% !TeX',
begin: /% ?!(?:T[eE]X|tex|BIB|bib)/,
schtandard marked this conversation as resolved.
Show resolved Hide resolved
end: '$',
relevance: 10
};
Expand Down
7 changes: 7 additions & 0 deletions test/markup/latex/comments.expect.txt
Expand Up @@ -2,3 +2,10 @@
foo<span class="hljs-comment">%</span>
<span class="hljs-meta">% !TeX program = pdflatex</span>
<span class="hljs-comment">%% !TeX encoding = utf8</span>
<span class="hljs-meta">%!TEX spellcheck = en-US</span>
<span class="hljs-comment">% !TeX foo</span>
<span class="hljs-meta">% !tex foo</span>
<span class="hljs-comment">% !tEx foo</span>
<span class="hljs-meta">% !BIB foo</span>
<span class="hljs-meta">%!bib foo</span>
<span class="hljs-comment">% !Bib foo</span>
7 changes: 7 additions & 0 deletions test/markup/latex/comments.txt
Expand Up @@ -2,3 +2,10 @@
foo%
% !TeX program = pdflatex
%% !TeX encoding = utf8
%!TEX spellcheck = en-US
% !TeX foo
% !tex foo
% !tEx foo
% !BIB foo
%!bib foo
% !Bib foo