summaryrefslogtreecommitdiffstats
path: root/deps/highlight.js/languages/tex.js
blob: a0b1fcc4e8fe63a08141f8b540a9af0741603fd7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
Language: TeX
Author: Vladimir Moskva <vladmos@gmail.com>
Website: http://fulc.ru/
*/

this.lang = function(hljs){

hljs.LANGUAGES.tex = {
  defaultMode: {
    contains: ['parameter', 'command', 'special', 'formula', 'comment']
  },
  modes: [
    {
      className: 'parameter',
      begin: '\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?', end: '^',
      returnBegin: true,
      contains: ['command', 'number'],
      noMarkup: true,
      relevance: 10
    },
    {
      className: 'command',
      begin: '\\\\[a-zA-Zа-яА-я]+[\\*]?', end: '^',
      relevance: 10
    },
    {
      className: 'command',
      begin: '\\\\[^a-zA-Zа-яА-я0-9]', end: '^',
      relevance: 0
    },
    {
      className: 'comment',
      begin: '%', end: '$',
      relevance: 0
    },
    {
      className: 'special',
      begin: '[{}\\[\\]\\&#~]', end: '^',
      relevance: 0
    },
    {
      className: 'formula',
      begin: '\\$\\$', end: '\\$\\$',
      contains: ['command', 'special'],
      relevance: 0
    },
    {
      className: 'formula',
      begin: '\\$', end: '\\$',
      contains: ['command', 'special'],
      relevance: 0
    },
    {
      className: 'number',
      begin: ' *=', end: '-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?',
      excludeBegin: true
    }
  ]
};

};