@mxmweb/rtext 1.6.12 → 1.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adopters/ChatMessageAdapter.d.ts +4 -0
- package/adopters/Markdownit.d.ts +2 -0
- package/adopters/PromptTempDesigner.d.ts +2 -0
- package/adopters/RetriveChatMessage.d.ts +4 -0
- package/assets/style.css +1 -1
- package/core/UnifiedRichText.d.ts +2 -0
- package/core/richElements/CodeBlock.d.ts +19 -0
- package/index.js +14 -30233
- package/lib_enter-Dc5XyCCf.js +31770 -0
- package/mockserverdata.d.ts +67 -29
- package/package.json +1 -1
- package/prism-bash-zSjFhtUz.js +219 -0
- package/prism-c-CXS5tkeN.js +76 -0
- package/prism-cpp-CvP_gscY.js +113 -0
- package/prism-css-3Jya3wSQ.js +55 -0
- package/prism-diff-Apx1lkH_.js +42 -0
- package/prism-go-CHuRSSd-.js +26 -0
- package/prism-java-DUOgyYJG.js +142 -0
- package/prism-javascript-CLux6jF8.js +137 -0
- package/prism-json-iVb7He6L.js +25 -0
- package/prism-jsx-yfun9EDN.js +51 -0
- package/prism-kotlin-QHMLy1lI.js +75 -0
- package/prism-markdown-tjNeCMi3.js +300 -0
- package/prism-markup-BNGj0Tvm.js +173 -0
- package/prism-php-BQcudfaM.js +347 -0
- package/prism-python-DERGD9Re.js +89 -0
- package/prism-ruby-DfaHE8ro.js +195 -0
- package/prism-rust-ChXOQips.js +144 -0
- package/prism-sql-8Y2-THrf.js +33 -0
- package/prism-swift-CeDyTyXT.js +113 -0
- package/prism-tsx-D_jjxt3I.js +6 -0
- package/prism-typescript-FZlwMqq2.js +73 -0
- package/prism-yaml-DwdKlmeG.js +66 -0
- package/stats.html +1 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { g as u } from "./lib_enter-Dc5XyCCf.js";
|
|
2
|
+
function p(t, a) {
|
|
3
|
+
for (var r = 0; r < a.length; r++) {
|
|
4
|
+
const e = a[r];
|
|
5
|
+
if (typeof e != "string" && !Array.isArray(e)) {
|
|
6
|
+
for (const s in e)
|
|
7
|
+
if (s !== "default" && !(s in t)) {
|
|
8
|
+
const n = Object.getOwnPropertyDescriptor(e, s);
|
|
9
|
+
n && Object.defineProperty(t, s, n.get ? n : {
|
|
10
|
+
enumerable: !0,
|
|
11
|
+
get: () => e[s]
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return Object.freeze(Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }));
|
|
17
|
+
}
|
|
18
|
+
var o = {}, i;
|
|
19
|
+
function d() {
|
|
20
|
+
return i || (i = 1, (function(t) {
|
|
21
|
+
var a = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/, r = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source, e = {
|
|
22
|
+
pattern: RegExp(/(^|[^\w.])/.source + r + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
|
|
23
|
+
lookbehind: !0,
|
|
24
|
+
inside: {
|
|
25
|
+
namespace: {
|
|
26
|
+
pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
|
|
27
|
+
inside: {
|
|
28
|
+
punctuation: /\./
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
punctuation: /\./
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
t.languages.java = t.languages.extend("clike", {
|
|
35
|
+
string: {
|
|
36
|
+
pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
|
|
37
|
+
lookbehind: !0,
|
|
38
|
+
greedy: !0
|
|
39
|
+
},
|
|
40
|
+
"class-name": [
|
|
41
|
+
e,
|
|
42
|
+
{
|
|
43
|
+
// variables, parameters, and constructor references
|
|
44
|
+
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
45
|
+
pattern: RegExp(/(^|[^\w.])/.source + r + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
|
|
46
|
+
lookbehind: !0,
|
|
47
|
+
inside: e.inside
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
// class names based on keyword
|
|
51
|
+
// this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
|
|
52
|
+
pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + r + /[A-Z]\w*\b/.source),
|
|
53
|
+
lookbehind: !0,
|
|
54
|
+
inside: e.inside
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
keyword: a,
|
|
58
|
+
function: [
|
|
59
|
+
t.languages.clike.function,
|
|
60
|
+
{
|
|
61
|
+
pattern: /(::\s*)[a-z_]\w*/,
|
|
62
|
+
lookbehind: !0
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
number: /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
|
|
66
|
+
operator: {
|
|
67
|
+
pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
|
|
68
|
+
lookbehind: !0
|
|
69
|
+
},
|
|
70
|
+
constant: /\b[A-Z][A-Z_\d]+\b/
|
|
71
|
+
}), t.languages.insertBefore("java", "string", {
|
|
72
|
+
"triple-quoted-string": {
|
|
73
|
+
// http://openjdk.java.net/jeps/355#Description
|
|
74
|
+
pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
|
|
75
|
+
greedy: !0,
|
|
76
|
+
alias: "string"
|
|
77
|
+
},
|
|
78
|
+
char: {
|
|
79
|
+
pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
|
|
80
|
+
greedy: !0
|
|
81
|
+
}
|
|
82
|
+
}), t.languages.insertBefore("java", "class-name", {
|
|
83
|
+
annotation: {
|
|
84
|
+
pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
|
|
85
|
+
lookbehind: !0,
|
|
86
|
+
alias: "punctuation"
|
|
87
|
+
},
|
|
88
|
+
generics: {
|
|
89
|
+
pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
|
|
90
|
+
inside: {
|
|
91
|
+
"class-name": e,
|
|
92
|
+
keyword: a,
|
|
93
|
+
punctuation: /[<>(),.:]/,
|
|
94
|
+
operator: /[?&|]/
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
import: [
|
|
98
|
+
{
|
|
99
|
+
pattern: RegExp(/(\bimport\s+)/.source + r + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
|
|
100
|
+
lookbehind: !0,
|
|
101
|
+
inside: {
|
|
102
|
+
namespace: e.inside.namespace,
|
|
103
|
+
punctuation: /\./,
|
|
104
|
+
operator: /\*/,
|
|
105
|
+
"class-name": /\w+/
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
pattern: RegExp(/(\bimport\s+static\s+)/.source + r + /(?:\w+|\*)(?=\s*;)/.source),
|
|
110
|
+
lookbehind: !0,
|
|
111
|
+
alias: "static",
|
|
112
|
+
inside: {
|
|
113
|
+
namespace: e.inside.namespace,
|
|
114
|
+
static: /\b\w+$/,
|
|
115
|
+
punctuation: /\./,
|
|
116
|
+
operator: /\*/,
|
|
117
|
+
"class-name": /\w+/
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
namespace: {
|
|
122
|
+
pattern: RegExp(
|
|
123
|
+
/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g, function() {
|
|
124
|
+
return a.source;
|
|
125
|
+
})
|
|
126
|
+
),
|
|
127
|
+
lookbehind: !0,
|
|
128
|
+
inside: {
|
|
129
|
+
punctuation: /\./
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
})(Prism)), o;
|
|
134
|
+
}
|
|
135
|
+
var c = d();
|
|
136
|
+
const l = /* @__PURE__ */ u(c), w = /* @__PURE__ */ p({
|
|
137
|
+
__proto__: null,
|
|
138
|
+
default: l
|
|
139
|
+
}, [c]);
|
|
140
|
+
export {
|
|
141
|
+
w as p
|
|
142
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Prism.languages.javascript = Prism.languages.extend("clike", {
|
|
2
|
+
"class-name": [
|
|
3
|
+
Prism.languages.clike["class-name"],
|
|
4
|
+
{
|
|
5
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
6
|
+
lookbehind: !0
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
keyword: [
|
|
10
|
+
{
|
|
11
|
+
pattern: /((?:^|\})\s*)catch\b/,
|
|
12
|
+
lookbehind: !0
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
|
16
|
+
lookbehind: !0
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
|
20
|
+
function: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
21
|
+
number: {
|
|
22
|
+
pattern: RegExp(
|
|
23
|
+
/(^|[^\w$])/.source + "(?:" + // constant
|
|
24
|
+
(/NaN|Infinity/.source + "|" + // binary integer
|
|
25
|
+
/0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
|
|
26
|
+
/0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
|
|
27
|
+
/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
|
|
28
|
+
/\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
|
|
29
|
+
/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
|
|
30
|
+
),
|
|
31
|
+
lookbehind: !0
|
|
32
|
+
},
|
|
33
|
+
operator: /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
34
|
+
});
|
|
35
|
+
Prism.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
|
|
36
|
+
Prism.languages.insertBefore("javascript", "keyword", {
|
|
37
|
+
regex: {
|
|
38
|
+
pattern: RegExp(
|
|
39
|
+
// lookbehind
|
|
40
|
+
// eslint-disable-next-line regexp/no-dupe-characters-character-class
|
|
41
|
+
/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
|
|
42
|
+
// There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
|
|
43
|
+
// classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
|
|
44
|
+
// with the only syntax, so we have to define 2 different regex patterns.
|
|
45
|
+
/\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
|
|
46
|
+
/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
|
|
47
|
+
/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
|
|
48
|
+
),
|
|
49
|
+
lookbehind: !0,
|
|
50
|
+
greedy: !0,
|
|
51
|
+
inside: {
|
|
52
|
+
"regex-source": {
|
|
53
|
+
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
54
|
+
lookbehind: !0,
|
|
55
|
+
alias: "language-regex",
|
|
56
|
+
inside: Prism.languages.regex
|
|
57
|
+
},
|
|
58
|
+
"regex-delimiter": /^\/|\/$/,
|
|
59
|
+
"regex-flags": /^[a-z]+$/
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
// This must be declared before keyword because we use "function" inside the look-forward
|
|
63
|
+
"function-variable": {
|
|
64
|
+
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
|
|
65
|
+
alias: "function"
|
|
66
|
+
},
|
|
67
|
+
parameter: [
|
|
68
|
+
{
|
|
69
|
+
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
70
|
+
lookbehind: !0,
|
|
71
|
+
inside: Prism.languages.javascript
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
75
|
+
lookbehind: !0,
|
|
76
|
+
inside: Prism.languages.javascript
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
80
|
+
lookbehind: !0,
|
|
81
|
+
inside: Prism.languages.javascript
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
|
85
|
+
lookbehind: !0,
|
|
86
|
+
inside: Prism.languages.javascript
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
constant: /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
90
|
+
});
|
|
91
|
+
Prism.languages.insertBefore("javascript", "string", {
|
|
92
|
+
hashbang: {
|
|
93
|
+
pattern: /^#!.*/,
|
|
94
|
+
greedy: !0,
|
|
95
|
+
alias: "comment"
|
|
96
|
+
},
|
|
97
|
+
"template-string": {
|
|
98
|
+
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
|
|
99
|
+
greedy: !0,
|
|
100
|
+
inside: {
|
|
101
|
+
"template-punctuation": {
|
|
102
|
+
pattern: /^`|`$/,
|
|
103
|
+
alias: "string"
|
|
104
|
+
},
|
|
105
|
+
interpolation: {
|
|
106
|
+
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
|
107
|
+
lookbehind: !0,
|
|
108
|
+
inside: {
|
|
109
|
+
"interpolation-punctuation": {
|
|
110
|
+
pattern: /^\$\{|\}$/,
|
|
111
|
+
alias: "punctuation"
|
|
112
|
+
},
|
|
113
|
+
rest: Prism.languages.javascript
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
string: /[\s\S]+/
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"string-property": {
|
|
120
|
+
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
|
121
|
+
lookbehind: !0,
|
|
122
|
+
greedy: !0,
|
|
123
|
+
alias: "property"
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Prism.languages.insertBefore("javascript", "operator", {
|
|
127
|
+
"literal-property": {
|
|
128
|
+
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
129
|
+
lookbehind: !0,
|
|
130
|
+
alias: "property"
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
Prism.languages.markup && (Prism.languages.markup.tag.addInlined("script", "javascript"), Prism.languages.markup.tag.addAttribute(
|
|
134
|
+
/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
|
|
135
|
+
"javascript"
|
|
136
|
+
));
|
|
137
|
+
Prism.languages.js = Prism.languages.javascript;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Prism.languages.json = {
|
|
2
|
+
property: {
|
|
3
|
+
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
|
|
4
|
+
lookbehind: !0,
|
|
5
|
+
greedy: !0
|
|
6
|
+
},
|
|
7
|
+
string: {
|
|
8
|
+
pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
|
|
9
|
+
lookbehind: !0,
|
|
10
|
+
greedy: !0
|
|
11
|
+
},
|
|
12
|
+
comment: {
|
|
13
|
+
pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
|
|
14
|
+
greedy: !0
|
|
15
|
+
},
|
|
16
|
+
number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
17
|
+
punctuation: /[{}[\],]/,
|
|
18
|
+
operator: /:/,
|
|
19
|
+
boolean: /\b(?:false|true)\b/,
|
|
20
|
+
null: {
|
|
21
|
+
pattern: /\bnull\b/,
|
|
22
|
+
alias: "keyword"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
Prism.languages.webmanifest = Prism.languages.json;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
(function(a) {
|
|
2
|
+
var l = a.util.clone(a.languages.javascript), f = /(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source, o = /(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source, u = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;
|
|
3
|
+
function c(e, t) {
|
|
4
|
+
return e = e.replace(/<S>/g, function() {
|
|
5
|
+
return f;
|
|
6
|
+
}).replace(/<BRACES>/g, function() {
|
|
7
|
+
return o;
|
|
8
|
+
}).replace(/<SPREAD>/g, function() {
|
|
9
|
+
return u;
|
|
10
|
+
}), RegExp(e, t);
|
|
11
|
+
}
|
|
12
|
+
u = c(u).source, a.languages.jsx = a.languages.extend("markup", l), a.languages.jsx.tag.pattern = c(
|
|
13
|
+
/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source
|
|
14
|
+
), a.languages.jsx.tag.inside.tag.pattern = /^<\/?[^\s>\/]*/, a.languages.jsx.tag.inside["attr-value"].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/, a.languages.jsx.tag.inside.tag.inside["class-name"] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/, a.languages.jsx.tag.inside.comment = l.comment, a.languages.insertBefore("inside", "attr-name", {
|
|
15
|
+
spread: {
|
|
16
|
+
pattern: c(/<SPREAD>/.source),
|
|
17
|
+
inside: a.languages.jsx
|
|
18
|
+
}
|
|
19
|
+
}, a.languages.jsx.tag), a.languages.insertBefore("inside", "special-attr", {
|
|
20
|
+
script: {
|
|
21
|
+
// Allow for two levels of nesting
|
|
22
|
+
pattern: c(/=<BRACES>/.source),
|
|
23
|
+
alias: "language-javascript",
|
|
24
|
+
inside: {
|
|
25
|
+
"script-punctuation": {
|
|
26
|
+
pattern: /^=(?=\{)/,
|
|
27
|
+
alias: "punctuation"
|
|
28
|
+
},
|
|
29
|
+
rest: a.languages.jsx
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, a.languages.jsx.tag);
|
|
33
|
+
var s = function(e) {
|
|
34
|
+
return e ? typeof e == "string" ? e : typeof e.content == "string" ? e.content : e.content.map(s).join("") : "";
|
|
35
|
+
}, p = function(e) {
|
|
36
|
+
for (var t = [], g = 0; g < e.length; g++) {
|
|
37
|
+
var n = e[g], i = !1;
|
|
38
|
+
if (typeof n != "string" && (n.type === "tag" && n.content[0] && n.content[0].type === "tag" ? n.content[0].content[0].content === "</" ? t.length > 0 && t[t.length - 1].tagName === s(n.content[0].content[1]) && t.pop() : n.content[n.content.length - 1].content === "/>" || t.push({
|
|
39
|
+
tagName: s(n.content[0].content[1]),
|
|
40
|
+
openedBraces: 0
|
|
41
|
+
}) : t.length > 0 && n.type === "punctuation" && n.content === "{" ? t[t.length - 1].openedBraces++ : t.length > 0 && t[t.length - 1].openedBraces > 0 && n.type === "punctuation" && n.content === "}" ? t[t.length - 1].openedBraces-- : i = !0), (i || typeof n == "string") && t.length > 0 && t[t.length - 1].openedBraces === 0) {
|
|
42
|
+
var r = s(n);
|
|
43
|
+
g < e.length - 1 && (typeof e[g + 1] == "string" || e[g + 1].type === "plain-text") && (r += s(e[g + 1]), e.splice(g + 1, 1)), g > 0 && (typeof e[g - 1] == "string" || e[g - 1].type === "plain-text") && (r = s(e[g - 1]) + r, e.splice(g - 1, 1), g--), e[g] = new a.Token("plain-text", r, null, r);
|
|
44
|
+
}
|
|
45
|
+
n.content && typeof n.content != "string" && p(n.content);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
a.hooks.add("after-tokenize", function(e) {
|
|
49
|
+
e.language !== "jsx" && e.language !== "tsx" || p(e.tokens);
|
|
50
|
+
});
|
|
51
|
+
})(Prism);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
(function(e) {
|
|
2
|
+
e.languages.kotlin = e.languages.extend("clike", {
|
|
3
|
+
keyword: {
|
|
4
|
+
// The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get
|
|
5
|
+
pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,
|
|
6
|
+
lookbehind: !0
|
|
7
|
+
},
|
|
8
|
+
function: [
|
|
9
|
+
{
|
|
10
|
+
pattern: /(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,
|
|
11
|
+
greedy: !0
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
pattern: /(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,
|
|
15
|
+
lookbehind: !0,
|
|
16
|
+
greedy: !0
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
number: /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,
|
|
20
|
+
operator: /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/
|
|
21
|
+
}), delete e.languages.kotlin["class-name"];
|
|
22
|
+
var n = {
|
|
23
|
+
"interpolation-punctuation": {
|
|
24
|
+
pattern: /^\$\{?|\}$/,
|
|
25
|
+
alias: "punctuation"
|
|
26
|
+
},
|
|
27
|
+
expression: {
|
|
28
|
+
pattern: /[\s\S]+/,
|
|
29
|
+
inside: e.languages.kotlin
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
e.languages.insertBefore("kotlin", "string", {
|
|
33
|
+
// https://kotlinlang.org/spec/expressions.html#string-interpolation-expressions
|
|
34
|
+
"string-literal": [
|
|
35
|
+
{
|
|
36
|
+
pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,
|
|
37
|
+
alias: "multiline",
|
|
38
|
+
inside: {
|
|
39
|
+
interpolation: {
|
|
40
|
+
pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i,
|
|
41
|
+
inside: n
|
|
42
|
+
},
|
|
43
|
+
string: /[\s\S]+/
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
pattern: /"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,
|
|
48
|
+
alias: "singleline",
|
|
49
|
+
inside: {
|
|
50
|
+
interpolation: {
|
|
51
|
+
pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,
|
|
52
|
+
lookbehind: !0,
|
|
53
|
+
inside: n
|
|
54
|
+
},
|
|
55
|
+
string: /[\s\S]+/
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
char: {
|
|
60
|
+
// https://kotlinlang.org/spec/expressions.html#character-literals
|
|
61
|
+
pattern: /'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,
|
|
62
|
+
greedy: !0
|
|
63
|
+
}
|
|
64
|
+
}), delete e.languages.kotlin.string, e.languages.insertBefore("kotlin", "keyword", {
|
|
65
|
+
annotation: {
|
|
66
|
+
pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
|
|
67
|
+
alias: "builtin"
|
|
68
|
+
}
|
|
69
|
+
}), e.languages.insertBefore("kotlin", "function", {
|
|
70
|
+
label: {
|
|
71
|
+
pattern: /\b\w+@|@\w+\b/,
|
|
72
|
+
alias: "symbol"
|
|
73
|
+
}
|
|
74
|
+
}), e.languages.kt = e.languages.kotlin, e.languages.kts = e.languages.kotlin;
|
|
75
|
+
})(Prism);
|