aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/utilities/highlight-json5.tid
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/utilities/highlight-json5.tid')
-rw-r--r--plugins/utilities/highlight-json5.tid59
1 files changed, 59 insertions, 0 deletions
diff --git a/plugins/utilities/highlight-json5.tid b/plugins/utilities/highlight-json5.tid
new file mode 100644
index 0000000..fae9bd4
--- /dev/null
+++ b/plugins/utilities/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: /[{}\[\],:]/
+ }
+ ]
+ };
+});