diff --git a/CHANGES.md b/CHANGES.md index 358345934d..2858a2b664 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 @@ -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 diff --git a/src/languages/latex.js b/src/languages/latex.js index 408e1d86b5..61f34d3907 100644 --- a/src/languages/latex.js +++ b/src/languages/latex.js @@ -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 }; diff --git a/test/markup/latex/comments.expect.txt b/test/markup/latex/comments.expect.txt index 69290f0496..abff4e9f73 100644 --- a/test/markup/latex/comments.expect.txt +++ b/test/markup/latex/comments.expect.txt @@ -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 diff --git a/test/markup/latex/comments.txt b/test/markup/latex/comments.txt index c12ec09044..2aa4c51ed1 100644 --- a/test/markup/latex/comments.txt +++ b/test/markup/latex/comments.txt @@ -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