main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.7 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | (function (Prism) {
|
---|
| 2 | var funcPattern = /\\(?:[^a-z()[\]]|[a-z*]+)/i;
|
---|
| 3 | var insideEqu = {
|
---|
| 4 | 'equation-command': {
|
---|
| 5 | pattern: funcPattern,
|
---|
| 6 | alias: 'regex'
|
---|
| 7 | }
|
---|
| 8 | };
|
---|
| 9 |
|
---|
| 10 | Prism.languages.latex = {
|
---|
| 11 | 'comment': /%.*/,
|
---|
| 12 | // the verbatim environment prints whitespace to the document
|
---|
| 13 | 'cdata': {
|
---|
| 14 | pattern: /(\\begin\{((?:lstlisting|verbatim)\*?)\})[\s\S]*?(?=\\end\{\2\})/,
|
---|
| 15 | lookbehind: true
|
---|
| 16 | },
|
---|
| 17 | /*
|
---|
| 18 | * equations can be between $$ $$ or $ $ or \( \) or \[ \]
|
---|
| 19 | * (all are multiline)
|
---|
| 20 | */
|
---|
| 21 | 'equation': [
|
---|
| 22 | {
|
---|
| 23 | pattern: /\$\$(?:\\[\s\S]|[^\\$])+\$\$|\$(?:\\[\s\S]|[^\\$])+\$|\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]/,
|
---|
| 24 | inside: insideEqu,
|
---|
| 25 | alias: 'string'
|
---|
| 26 | },
|
---|
| 27 | {
|
---|
| 28 | pattern: /(\\begin\{((?:align|eqnarray|equation|gather|math|multline)\*?)\})[\s\S]*?(?=\\end\{\2\})/,
|
---|
| 29 | lookbehind: true,
|
---|
| 30 | inside: insideEqu,
|
---|
| 31 | alias: 'string'
|
---|
| 32 | }
|
---|
| 33 | ],
|
---|
| 34 | /*
|
---|
| 35 | * arguments which are keywords or references are highlighted
|
---|
| 36 | * as keywords
|
---|
| 37 | */
|
---|
| 38 | 'keyword': {
|
---|
| 39 | pattern: /(\\(?:begin|cite|documentclass|end|label|ref|usepackage)(?:\[[^\]]+\])?\{)[^}]+(?=\})/,
|
---|
| 40 | lookbehind: true
|
---|
| 41 | },
|
---|
| 42 | 'url': {
|
---|
| 43 | pattern: /(\\url\{)[^}]+(?=\})/,
|
---|
| 44 | lookbehind: true
|
---|
| 45 | },
|
---|
| 46 | /*
|
---|
| 47 | * section or chapter headlines are highlighted as bold so that
|
---|
| 48 | * they stand out more
|
---|
| 49 | */
|
---|
| 50 | 'headline': {
|
---|
| 51 | pattern: /(\\(?:chapter|frametitle|paragraph|part|section|subparagraph|subsection|subsubparagraph|subsubsection|subsubsubparagraph)\*?(?:\[[^\]]+\])?\{)[^}]+(?=\})/,
|
---|
| 52 | lookbehind: true,
|
---|
| 53 | alias: 'class-name'
|
---|
| 54 | },
|
---|
| 55 | 'function': {
|
---|
| 56 | pattern: funcPattern,
|
---|
| 57 | alias: 'selector'
|
---|
| 58 | },
|
---|
| 59 | 'punctuation': /[[\]{}&]/
|
---|
| 60 | };
|
---|
| 61 |
|
---|
| 62 | Prism.languages.tex = Prism.languages.latex;
|
---|
| 63 | Prism.languages.context = Prism.languages.latex;
|
---|
| 64 | }(Prism));
|
---|
Note:
See
TracBrowser
for help on using the repository browser.