Skip to content

Commit

Permalink
enh(latex) Allow wider syntax for magic comments (#3249)
Browse files Browse the repository at this point in the history
* Recognize wider syntax for magic comments
  • Loading branch information
schtandard committed Jun 18, 2021
1 parent 19711d4 commit bc78477
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
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)/,
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

0 comments on commit bc78477

Please sign in to comment.