]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/nestedtext.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / nestedtext.js
1 /*! `nestedtext` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: NestedText
7 Description: NestedText is a file format for holding data that is to be entered, edited, or viewed by people.
8 Website: https://nestedtext.org/
9 Category: config
10 */
11
12 /** @type LanguageFn */
13 function nestedtext(hljs) {
14 const NESTED = {
15 match: [
16 /^\s*(?=\S)/, // have to look forward here to avoid polynomial backtracking
17 /[^:]+/,
18 /:\s*/,
19 /$/
20 ],
21 className: {
22 2: "attribute",
23 3: "punctuation"
24 }
25 };
26 const DICTIONARY_ITEM = {
27 match: [
28 /^\s*(?=\S)/, // have to look forward here to avoid polynomial backtracking
29 /[^:]*[^: ]/,
30 /[ ]*:/,
31 /[ ]/,
32 /.*$/
33 ],
34 className: {
35 2: "attribute",
36 3: "punctuation",
37 5: "string"
38 }
39 };
40 const STRING = {
41 match: [
42 /^\s*/,
43 />/,
44 /[ ]/,
45 /.*$/
46 ],
47 className: {
48 2: "punctuation",
49 4: "string"
50 }
51 };
52 const LIST_ITEM = {
53 variants: [
54 { match: [
55 /^\s*/,
56 /-/,
57 /[ ]/,
58 /.*$/
59 ] },
60 { match: [
61 /^\s*/,
62 /-$/
63 ] }
64 ],
65 className: {
66 2: "bullet",
67 4: "string"
68 }
69 };
70
71 return {
72 name: 'Nested Text',
73 aliases: [ 'nt' ],
74 contains: [
75 hljs.inherit(hljs.HASH_COMMENT_MODE, {
76 begin: /^\s*(?=#)/,
77 excludeBegin: true
78 }),
79 LIST_ITEM,
80 STRING,
81 NESTED,
82 DICTIONARY_ITEM
83 ]
84 };
85 }
86
87 return nestedtext;
88
89 })();
90 ;
91 export default hljsGrammar;