@mxmweb/rtext 1.6.12 → 1.6.14

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.
@@ -0,0 +1,300 @@
1
+ (function(e) {
2
+ var f = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
3
+ function d(n) {
4
+ return n = n.replace(/<inner>/g, function() {
5
+ return f;
6
+ }), RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + "(?:" + n + ")");
7
+ }
8
+ var g = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source, p = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function() {
9
+ return g;
10
+ }), c = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
11
+ e.languages.markdown = e.languages.extend("markup", {}), e.languages.insertBefore("markdown", "prolog", {
12
+ "front-matter-block": {
13
+ pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
14
+ lookbehind: !0,
15
+ greedy: !0,
16
+ inside: {
17
+ punctuation: /^---|---$/,
18
+ "front-matter": {
19
+ pattern: /\S+(?:\s+\S+)*/,
20
+ alias: ["yaml", "language-yaml"],
21
+ inside: e.languages.yaml
22
+ }
23
+ }
24
+ },
25
+ blockquote: {
26
+ // > ...
27
+ pattern: /^>(?:[\t ]*>)*/m,
28
+ alias: "punctuation"
29
+ },
30
+ table: {
31
+ pattern: RegExp("^" + p + c + "(?:" + p + ")*", "m"),
32
+ inside: {
33
+ "table-data-rows": {
34
+ pattern: RegExp("^(" + p + c + ")(?:" + p + ")*$"),
35
+ lookbehind: !0,
36
+ inside: {
37
+ "table-data": {
38
+ pattern: RegExp(g),
39
+ inside: e.languages.markdown
40
+ },
41
+ punctuation: /\|/
42
+ }
43
+ },
44
+ "table-line": {
45
+ pattern: RegExp("^(" + p + ")" + c + "$"),
46
+ lookbehind: !0,
47
+ inside: {
48
+ punctuation: /\||:?-{3,}:?/
49
+ }
50
+ },
51
+ "table-header-row": {
52
+ pattern: RegExp("^" + p + "$"),
53
+ inside: {
54
+ "table-header": {
55
+ pattern: RegExp(g),
56
+ alias: "important",
57
+ inside: e.languages.markdown
58
+ },
59
+ punctuation: /\|/
60
+ }
61
+ }
62
+ }
63
+ },
64
+ code: [
65
+ {
66
+ // Prefixed by 4 spaces or 1 tab and preceded by an empty line
67
+ pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
68
+ lookbehind: !0,
69
+ alias: "keyword"
70
+ },
71
+ {
72
+ // ```optional language
73
+ // code block
74
+ // ```
75
+ pattern: /^```[\s\S]*?^```$/m,
76
+ greedy: !0,
77
+ inside: {
78
+ "code-block": {
79
+ pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
80
+ lookbehind: !0
81
+ },
82
+ "code-language": {
83
+ pattern: /^(```).+/,
84
+ lookbehind: !0
85
+ },
86
+ punctuation: /```/
87
+ }
88
+ }
89
+ ],
90
+ title: [
91
+ {
92
+ // title 1
93
+ // =======
94
+ // title 2
95
+ // -------
96
+ pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
97
+ alias: "important",
98
+ inside: {
99
+ punctuation: /==+$|--+$/
100
+ }
101
+ },
102
+ {
103
+ // # title 1
104
+ // ###### title 6
105
+ pattern: /(^\s*)#.+/m,
106
+ lookbehind: !0,
107
+ alias: "important",
108
+ inside: {
109
+ punctuation: /^#+|#+$/
110
+ }
111
+ }
112
+ ],
113
+ hr: {
114
+ // ***
115
+ // ---
116
+ // * * *
117
+ // -----------
118
+ pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
119
+ lookbehind: !0,
120
+ alias: "punctuation"
121
+ },
122
+ list: {
123
+ // * item
124
+ // + item
125
+ // - item
126
+ // 1. item
127
+ pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
128
+ lookbehind: !0,
129
+ alias: "punctuation"
130
+ },
131
+ "url-reference": {
132
+ // [id]: http://example.com "Optional title"
133
+ // [id]: http://example.com 'Optional title'
134
+ // [id]: http://example.com (Optional title)
135
+ // [id]: <http://example.com> "Optional title"
136
+ pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
137
+ inside: {
138
+ variable: {
139
+ pattern: /^(!?\[)[^\]]+/,
140
+ lookbehind: !0
141
+ },
142
+ string: /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
143
+ punctuation: /^[\[\]!:]|[<>]/
144
+ },
145
+ alias: "url"
146
+ },
147
+ bold: {
148
+ // **strong**
149
+ // __strong__
150
+ // allow one nested instance of italic text using the same delimiter
151
+ pattern: d(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
152
+ lookbehind: !0,
153
+ greedy: !0,
154
+ inside: {
155
+ content: {
156
+ pattern: /(^..)[\s\S]+(?=..$)/,
157
+ lookbehind: !0,
158
+ inside: {}
159
+ // see below
160
+ },
161
+ punctuation: /\*\*|__/
162
+ }
163
+ },
164
+ italic: {
165
+ // *em*
166
+ // _em_
167
+ // allow one nested instance of bold text using the same delimiter
168
+ pattern: d(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
169
+ lookbehind: !0,
170
+ greedy: !0,
171
+ inside: {
172
+ content: {
173
+ pattern: /(^.)[\s\S]+(?=.$)/,
174
+ lookbehind: !0,
175
+ inside: {}
176
+ // see below
177
+ },
178
+ punctuation: /[*_]/
179
+ }
180
+ },
181
+ strike: {
182
+ // ~~strike through~~
183
+ // ~strike~
184
+ // eslint-disable-next-line regexp/strict
185
+ pattern: d(/(~~?)(?:(?!~)<inner>)+\2/.source),
186
+ lookbehind: !0,
187
+ greedy: !0,
188
+ inside: {
189
+ content: {
190
+ pattern: /(^~~?)[\s\S]+(?=\1$)/,
191
+ lookbehind: !0,
192
+ inside: {}
193
+ // see below
194
+ },
195
+ punctuation: /~~?/
196
+ }
197
+ },
198
+ "code-snippet": {
199
+ // `code`
200
+ // ``code``
201
+ pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
202
+ lookbehind: !0,
203
+ greedy: !0,
204
+ alias: ["code", "keyword"]
205
+ },
206
+ url: {
207
+ // [example](http://example.com "Optional title")
208
+ // [example][id]
209
+ // [example] [id]
210
+ pattern: d(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
211
+ lookbehind: !0,
212
+ greedy: !0,
213
+ inside: {
214
+ operator: /^!/,
215
+ content: {
216
+ pattern: /(^\[)[^\]]+(?=\])/,
217
+ lookbehind: !0,
218
+ inside: {}
219
+ // see below
220
+ },
221
+ variable: {
222
+ pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
223
+ lookbehind: !0
224
+ },
225
+ url: {
226
+ pattern: /(^\]\()[^\s)]+/,
227
+ lookbehind: !0
228
+ },
229
+ string: {
230
+ pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
231
+ lookbehind: !0
232
+ }
233
+ }
234
+ }
235
+ }), ["url", "bold", "italic", "strike"].forEach(function(n) {
236
+ ["url", "bold", "italic", "strike", "code-snippet"].forEach(function(t) {
237
+ n !== t && (e.languages.markdown[n].inside.content.inside[t] = e.languages.markdown[t]);
238
+ });
239
+ }), e.hooks.add("after-tokenize", function(n) {
240
+ if (n.language !== "markdown" && n.language !== "md")
241
+ return;
242
+ function t(i) {
243
+ if (!(!i || typeof i == "string"))
244
+ for (var r = 0, u = i.length; r < u; r++) {
245
+ var o = i[r];
246
+ if (o.type !== "code") {
247
+ t(o.content);
248
+ continue;
249
+ }
250
+ var l = o.content[1], a = o.content[3];
251
+ if (l && a && l.type === "code-language" && a.type === "code-block" && typeof l.content == "string") {
252
+ var s = l.content.replace(/\b#/g, "sharp").replace(/\b\+\+/g, "pp");
253
+ s = (/[a-z][\w-]*/i.exec(s) || [""])[0].toLowerCase();
254
+ var b = "language-" + s;
255
+ a.alias ? typeof a.alias == "string" ? a.alias = [a.alias, b] : a.alias.push(b) : a.alias = [b];
256
+ }
257
+ }
258
+ }
259
+ t(n.tokens);
260
+ }), e.hooks.add("wrap", function(n) {
261
+ if (n.type === "code-block") {
262
+ for (var t = "", i = 0, r = n.classes.length; i < r; i++) {
263
+ var u = n.classes[i], o = /language-(.+)/.exec(u);
264
+ if (o) {
265
+ t = o[1];
266
+ break;
267
+ }
268
+ }
269
+ var l = e.languages[t];
270
+ if (l)
271
+ n.content = e.highlight(m(n.content), l, t);
272
+ else if (t && t !== "none" && e.plugins.autoloader) {
273
+ var a = "md-" + (/* @__PURE__ */ new Date()).valueOf() + "-" + Math.floor(Math.random() * 1e16);
274
+ n.attributes.id = a, e.plugins.autoloader.loadLanguages(t, function() {
275
+ var s = document.getElementById(a);
276
+ s && (s.innerHTML = e.highlight(s.textContent, e.languages[t], t));
277
+ });
278
+ }
279
+ }
280
+ });
281
+ var h = RegExp(e.languages.markup.tag.pattern.source, "gi"), k = {
282
+ amp: "&",
283
+ lt: "<",
284
+ gt: ">",
285
+ quot: '"'
286
+ }, _ = String.fromCodePoint || String.fromCharCode;
287
+ function m(n) {
288
+ var t = n.replace(h, "");
289
+ return t = t.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function(i, r) {
290
+ if (r = r.toLowerCase(), r[0] === "#") {
291
+ var u;
292
+ return r[1] === "x" ? u = parseInt(r.slice(2), 16) : u = Number(r.slice(1)), _(u);
293
+ } else {
294
+ var o = k[r];
295
+ return o || i;
296
+ }
297
+ }), t;
298
+ }
299
+ e.languages.md = e.languages.markdown;
300
+ })(Prism);
@@ -0,0 +1,173 @@
1
+ Prism.languages.markup = {
2
+ comment: {
3
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
4
+ greedy: !0
5
+ },
6
+ prolog: {
7
+ pattern: /<\?[\s\S]+?\?>/,
8
+ greedy: !0
9
+ },
10
+ doctype: {
11
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
12
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
13
+ greedy: !0,
14
+ inside: {
15
+ "internal-subset": {
16
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
17
+ lookbehind: !0,
18
+ greedy: !0,
19
+ inside: null
20
+ // see below
21
+ },
22
+ string: {
23
+ pattern: /"[^"]*"|'[^']*'/,
24
+ greedy: !0
25
+ },
26
+ punctuation: /^<!|>$|[[\]]/,
27
+ "doctype-tag": /^DOCTYPE/i,
28
+ name: /[^\s<>'"]+/
29
+ }
30
+ },
31
+ cdata: {
32
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
33
+ greedy: !0
34
+ },
35
+ tag: {
36
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
37
+ greedy: !0,
38
+ inside: {
39
+ tag: {
40
+ pattern: /^<\/?[^\s>\/]+/,
41
+ inside: {
42
+ punctuation: /^<\/?/,
43
+ namespace: /^[^\s>\/:]+:/
44
+ }
45
+ },
46
+ "special-attr": [],
47
+ "attr-value": {
48
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
49
+ inside: {
50
+ punctuation: [
51
+ {
52
+ pattern: /^=/,
53
+ alias: "attr-equals"
54
+ },
55
+ {
56
+ pattern: /^(\s*)["']|["']$/,
57
+ lookbehind: !0
58
+ }
59
+ ]
60
+ }
61
+ },
62
+ punctuation: /\/?>/,
63
+ "attr-name": {
64
+ pattern: /[^\s>\/]+/,
65
+ inside: {
66
+ namespace: /^[^\s>\/:]+:/
67
+ }
68
+ }
69
+ }
70
+ },
71
+ entity: [
72
+ {
73
+ pattern: /&[\da-z]{1,8};/i,
74
+ alias: "named-entity"
75
+ },
76
+ /&#x?[\da-f]{1,8};/i
77
+ ]
78
+ };
79
+ Prism.languages.markup.tag.inside["attr-value"].inside.entity = Prism.languages.markup.entity;
80
+ Prism.languages.markup.doctype.inside["internal-subset"].inside = Prism.languages.markup;
81
+ Prism.hooks.add("wrap", function(e) {
82
+ e.type === "entity" && (e.attributes.title = e.content.replace(/&amp;/, "&"));
83
+ });
84
+ Object.defineProperty(Prism.languages.markup.tag, "addInlined", {
85
+ /**
86
+ * Adds an inlined language to markup.
87
+ *
88
+ * An example of an inlined language is CSS with `<style>` tags.
89
+ *
90
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
91
+ * case insensitive.
92
+ * @param {string} lang The language key.
93
+ * @example
94
+ * addInlined('style', 'css');
95
+ */
96
+ value: function(a, t) {
97
+ var s = {};
98
+ s["language-" + t] = {
99
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
100
+ lookbehind: !0,
101
+ inside: Prism.languages[t]
102
+ }, s.cdata = /^<!\[CDATA\[|\]\]>$/i;
103
+ var n = {
104
+ "included-cdata": {
105
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
106
+ inside: s
107
+ }
108
+ };
109
+ n["language-" + t] = {
110
+ pattern: /[\s\S]+/,
111
+ inside: Prism.languages[t]
112
+ };
113
+ var i = {};
114
+ i[a] = {
115
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
116
+ return a;
117
+ }), "i"),
118
+ lookbehind: !0,
119
+ greedy: !0,
120
+ inside: n
121
+ }, Prism.languages.insertBefore("markup", "cdata", i);
122
+ }
123
+ });
124
+ Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
125
+ /**
126
+ * Adds an pattern to highlight languages embedded in HTML attributes.
127
+ *
128
+ * An example of an inlined language is CSS with `style` attributes.
129
+ *
130
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
131
+ * case insensitive.
132
+ * @param {string} lang The language key.
133
+ * @example
134
+ * addAttribute('style', 'css');
135
+ */
136
+ value: function(e, a) {
137
+ Prism.languages.markup.tag.inside["special-attr"].push({
138
+ pattern: RegExp(
139
+ /(^|["'\s])/.source + "(?:" + e + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
140
+ "i"
141
+ ),
142
+ lookbehind: !0,
143
+ inside: {
144
+ "attr-name": /^[^\s=]+/,
145
+ "attr-value": {
146
+ pattern: /=[\s\S]+/,
147
+ inside: {
148
+ value: {
149
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
150
+ lookbehind: !0,
151
+ alias: [a, "language-" + a],
152
+ inside: Prism.languages[a]
153
+ },
154
+ punctuation: [
155
+ {
156
+ pattern: /^=/,
157
+ alias: "attr-equals"
158
+ },
159
+ /"|'/
160
+ ]
161
+ }
162
+ }
163
+ }
164
+ });
165
+ }
166
+ });
167
+ Prism.languages.html = Prism.languages.markup;
168
+ Prism.languages.mathml = Prism.languages.markup;
169
+ Prism.languages.svg = Prism.languages.markup;
170
+ Prism.languages.xml = Prism.languages.extend("markup", {});
171
+ Prism.languages.ssml = Prism.languages.xml;
172
+ Prism.languages.atom = Prism.languages.xml;
173
+ Prism.languages.rss = Prism.languages.xml;