UNPKG

1.06 kBJavaScriptView Raw
1(function (Prism) {
2
3 var variable = /\$(?:\w[a-z\d]*(?:_[^\x00-\x1F\s"'\\()$]*)?|\{[^}\s"'\\]+\})/i;
4
5 Prism.languages.nginx = {
6 'comment': {
7 pattern: /(^|[\s{};])#.*/,
8 lookbehind: true
9 },
10 'directive': {
11 pattern: /(^|\s)\w(?:[^;{}"'\\\s]|\\.|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\s+(?:#.*(?!.)|(?![#\s])))*?(?=\s*[;{])/,
12 lookbehind: true,
13 greedy: true,
14 inside: {
15 'string': {
16 pattern: /((?:^|[^\\])(?:\\\\)*)(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/,
17 lookbehind: true,
18 inside: {
19 'escape': {
20 pattern: /\\["'\\nrt]/,
21 alias: 'entity'
22 },
23 'variable': variable
24 }
25 },
26 'comment': {
27 pattern: /(\s)#.*/,
28 lookbehind: true,
29 greedy: true
30 },
31 'keyword': {
32 pattern: /^\S+/,
33 greedy: true
34 },
35
36 // other patterns
37
38 'boolean': {
39 pattern: /(\s)(?:off|on)(?!\S)/,
40 lookbehind: true
41 },
42 'number': {
43 pattern: /(\s)\d+[a-z]*(?!\S)/i,
44 lookbehind: true
45 },
46 'variable': variable
47 }
48 },
49 'punctuation': /[{};]/
50 };
51
52}(Prism));