diff options
| author | shu <nvcsadjkojf@outlook.com> | 2026-07-26 22:42:45 +0800 |
|---|---|---|
| committer | shu <nvcsadjkojf@outlook.com> | 2026-07-26 22:42:45 +0800 |
| commit | 338cc101f127e4841689c1f81227ee033e57ad28 (patch) | |
| tree | 490cfc2ca29dc28e116a979f5c19b0851c3ea32e /tiddlers/plugin-highlight-json5.tid | |
| parent | 1888ff59743d83bd7776b0f16ef0bc20d68e3e10 (diff) | |
Add task board and organize local plugins
Diffstat (limited to 'tiddlers/plugin-highlight-json5.tid')
| -rw-r--r-- | tiddlers/plugin-highlight-json5.tid | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tiddlers/plugin-highlight-json5.tid b/tiddlers/plugin-highlight-json5.tid new file mode 100644 index 0000000..fae9bd4 --- /dev/null +++ b/tiddlers/plugin-highlight-json5.tid @@ -0,0 +1,59 @@ +title: $:/plugins/local/highlight-languages/json5.js +type: application/javascript +module-type: highlight + +/*\ +title: $:/plugins/local/highlight-languages/json5.js +type: application/javascript +module-type: highlight + +JSON5 language definition for highlight.js. +\*/ +"use strict"; + +hljs.registerLanguage("json5",function(hljs) { + return { + name: "JSON5", + aliases: ["json5"], + keywords: { + literal: "true false null" + }, + contains: [ + hljs.C_LINE_COMMENT_MODE, + hljs.C_BLOCK_COMMENT_MODE, + { + className: "attr", + match: /[A-Za-z_$][0-9A-Za-z_$]*(?=\s*:)/ + }, + { + className: "attr", + match: /"(?:\\.|[^"\\\r\n])*"(?=\s*:)/ + }, + { + className: "attr", + match: /'(?:\\.|[^'\\\r\n])*'(?=\s*:)/ + }, + hljs.QUOTE_STRING_MODE, + hljs.APOS_STRING_MODE, + { + className: "number", + variants: [ + { + begin: /[+-]?(?:Infinity|NaN)\b/ + }, + { + begin: /[+-]?0[xX][0-9a-fA-F]+\b/ + }, + { + begin: /[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/ + } + ], + relevance: 0 + }, + { + className: "punctuation", + match: /[{}\[\],:]/ + } + ] + }; +}); |
