@xlxz/markdown-editor 2.0.0

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.
Files changed (66) hide show
  1. package/dist/index.cjs +1806 -0
  2. package/dist/index.d.ts +23 -0
  3. package/dist/index.js +1774 -0
  4. package/dist/plugins/attachment.d.ts +7 -0
  5. package/dist/plugins/base-extensions.d.ts +8 -0
  6. package/dist/plugins/close-brackets.d.ts +8 -0
  7. package/dist/plugins/expand-text.d.ts +11 -0
  8. package/dist/plugins/fold.d.ts +8 -0
  9. package/dist/plugins/hanging-indent.d.ts +7 -0
  10. package/dist/plugins/indent-guide.d.ts +7 -0
  11. package/dist/plugins/index.d.ts +22 -0
  12. package/dist/plugins/keymap.d.ts +8 -0
  13. package/dist/plugins/line-numbers.d.ts +7 -0
  14. package/dist/plugins/link-handler.d.ts +8 -0
  15. package/dist/plugins/list-continuation.d.ts +8 -0
  16. package/dist/plugins/live-preview.d.ts +8 -0
  17. package/dist/plugins/markdown-language.d.ts +8 -0
  18. package/dist/plugins/on-change.d.ts +7 -0
  19. package/dist/plugins/suggest.d.ts +16 -0
  20. package/dist/plugins/table-continuation.d.ts +9 -0
  21. package/dist/plugins/table.d.ts +7 -0
  22. package/dist/plugins/theme.d.ts +8 -0
  23. package/dist/plugins/types.d.ts +29 -0
  24. package/dist/table/copy-widget.d.ts +17 -0
  25. package/dist/table/detect.d.ts +15 -0
  26. package/dist/table/format.d.ts +15 -0
  27. package/dist/table/index.d.ts +6 -0
  28. package/dist/table/theme.d.ts +8 -0
  29. package/package.json +57 -0
  30. package/vendor/app.css +15715 -0
  31. package/vendor/enhance.js +641 -0
  32. package/vendor/i18n/en.json +2144 -0
  33. package/vendor/i18n/zh.json +2144 -0
  34. package/vendor/lib/codemirror.js +14806 -0
  35. package/vendor/lib/i18next.min.js +2654 -0
  36. package/vendor/lib/markdown.js +1717 -0
  37. package/vendor/lib/mathjax/output/chtml/fonts/tex.js +1 -0
  38. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
  39. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
  40. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
  41. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
  42. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
  43. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
  44. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
  45. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
  46. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
  47. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
  48. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
  49. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
  50. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
  51. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
  52. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
  53. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
  54. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
  55. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
  56. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
  57. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
  58. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
  59. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
  60. package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
  61. package/vendor/lib/mathjax/tex-chtml-full.js +36 -0
  62. package/vendor/lib/meta.min.js +1 -0
  63. package/vendor/lib/modes.min.js +236 -0
  64. package/vendor/lib/turndown.js +679 -0
  65. package/vendor/mock.js +28 -0
  66. package/vendor/obsidian-app.patched.js +161786 -0
@@ -0,0 +1,1717 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
3
+
4
+ // xml
5
+ !(function () {
6
+ var N = {
7
+ autoSelfClosers: {
8
+ area: !0,
9
+ base: !0,
10
+ br: !0,
11
+ col: !0,
12
+ command: !0,
13
+ embed: !0,
14
+ frame: !0,
15
+ hr: !0,
16
+ img: !0,
17
+ input: !0,
18
+ keygen: !0,
19
+ link: !0,
20
+ meta: !0,
21
+ param: !0,
22
+ source: !0,
23
+ track: !0,
24
+ wbr: !0,
25
+ menuitem: !0,
26
+ },
27
+ implicitlyClosed: {
28
+ dd: !0,
29
+ li: !0,
30
+ optgroup: !0,
31
+ option: !0,
32
+ p: !0,
33
+ rp: !0,
34
+ rt: !0,
35
+ tbody: !0,
36
+ td: !0,
37
+ tfoot: !0,
38
+ th: !0,
39
+ tr: !0,
40
+ },
41
+ contextGrabbers: {
42
+ dd: { dd: !0, dt: !0 },
43
+ dt: { dd: !0, dt: !0 },
44
+ li: { li: !0 },
45
+ option: { option: !0, optgroup: !0 },
46
+ optgroup: { optgroup: !0 },
47
+ p: {
48
+ address: !0,
49
+ article: !0,
50
+ aside: !0,
51
+ blockquote: !0,
52
+ dir: !0,
53
+ div: !0,
54
+ dl: !0,
55
+ fieldset: !0,
56
+ footer: !0,
57
+ form: !0,
58
+ h1: !0,
59
+ h2: !0,
60
+ h3: !0,
61
+ h4: !0,
62
+ h5: !0,
63
+ h6: !0,
64
+ header: !0,
65
+ hgroup: !0,
66
+ hr: !0,
67
+ menu: !0,
68
+ nav: !0,
69
+ ol: !0,
70
+ p: !0,
71
+ pre: !0,
72
+ section: !0,
73
+ table: !0,
74
+ ul: !0,
75
+ },
76
+ rp: { rp: !0, rt: !0 },
77
+ rt: { rp: !0, rt: !0 },
78
+ tbody: { tbody: !0, tfoot: !0 },
79
+ td: { td: !0, th: !0 },
80
+ tfoot: { tbody: !0 },
81
+ th: { td: !0, th: !0 },
82
+ thead: { tbody: !0, tfoot: !0 },
83
+ tr: { tr: !0 },
84
+ },
85
+ doNotIndent: { pre: !0 },
86
+ allowUnquoted: !0,
87
+ allowMissing: !0,
88
+ caseFold: !0,
89
+ },
90
+ M = {
91
+ autoSelfClosers: {},
92
+ implicitlyClosed: {},
93
+ contextGrabbers: {},
94
+ doNotIndent: {},
95
+ allowUnquoted: !1,
96
+ allowMissing: !1,
97
+ allowMissingTagName: !1,
98
+ caseFold: !1,
99
+ };
100
+ (CodeMirror.defineMode("xml", function (t, e) {
101
+ var r,
102
+ a,
103
+ i,
104
+ l = t.indentUnit,
105
+ u = {},
106
+ n = e.htmlMode ? N : M;
107
+ for (r in n) u[r] = n[r];
108
+ for (r in e) u[r] = e[r];
109
+ function d(e, r) {
110
+ function t(t) {
111
+ return (r.tokenize = t)(e, r);
112
+ }
113
+ var n = e.next();
114
+ if ("<" == n)
115
+ return e.eat("!")
116
+ ? e.eat("[")
117
+ ? e.match("CDATA[")
118
+ ? t(o("atom", "]]>"))
119
+ : null
120
+ : e.match("--")
121
+ ? t(o("comment", "--\x3e"))
122
+ : e.match("DOCTYPE", !0, !0)
123
+ ? (e.eatWhile(/[\w\._\-]/),
124
+ t(
125
+ (function n(o) {
126
+ return function (t, e) {
127
+ for (var r; null != (r = t.next()); ) {
128
+ if ("<" == r)
129
+ return ((e.tokenize = n(o + 1)), e.tokenize(t, e));
130
+ if (">" == r) {
131
+ if (1 != o)
132
+ return (
133
+ (e.tokenize = n(o - 1)),
134
+ e.tokenize(t, e)
135
+ );
136
+ e.tokenize = d;
137
+ break;
138
+ }
139
+ }
140
+ return "meta";
141
+ };
142
+ })(1),
143
+ ))
144
+ : null
145
+ : e.eat("?")
146
+ ? (e.eatWhile(/[\w\._\-]/), (r.tokenize = o("meta", "?>")), "meta")
147
+ : ((a = e.eat("/") ? "closeTag" : "openTag"),
148
+ (r.tokenize = s),
149
+ "tag bracket");
150
+ if ("&" != n) return (e.eatWhile(/[^&<]/), null);
151
+ n = e.eat("#")
152
+ ? e.eat("x")
153
+ ? e.eatWhile(/[a-fA-F\d]/) && e.eat(";")
154
+ : e.eatWhile(/[\d]/) && e.eat(";")
155
+ : e.eatWhile(/[\w\.\-:]/) && e.eat(";");
156
+ return n ? "atom" : "error";
157
+ }
158
+ function s(t, e) {
159
+ var r = t.next();
160
+ if (">" == r || ("/" == r && t.eat(">")))
161
+ return (
162
+ (e.tokenize = d),
163
+ (a = ">" == r ? "endTag" : "selfcloseTag"),
164
+ "tag bracket"
165
+ );
166
+ if ("=" == r) return ((a = "equals"), null);
167
+ if ("<" != r)
168
+ return /[\'\"]/.test(r)
169
+ ? ((e.tokenize = ((n = r), (o.isInAttribute = !0), o)),
170
+ (e.stringStartCol = t.column()),
171
+ e.tokenize(t, e))
172
+ : (t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/), "word");
173
+ ((e.tokenize = d), (e.state = p), (e.tagName = e.tagStart = null));
174
+ var n,
175
+ e = e.tokenize(t, e);
176
+ return e ? e + " tag error" : "tag error";
177
+ function o(t, e) {
178
+ for (; !t.eol(); )
179
+ if (t.next() == n) {
180
+ e.tokenize = s;
181
+ break;
182
+ }
183
+ return "string";
184
+ }
185
+ }
186
+ function o(r, n) {
187
+ return function (t, e) {
188
+ for (; !t.eol(); ) {
189
+ if (t.match(n)) {
190
+ e.tokenize = d;
191
+ break;
192
+ }
193
+ t.next();
194
+ }
195
+ return r;
196
+ };
197
+ }
198
+ function c(t) {
199
+ return t && t.toLowerCase();
200
+ }
201
+ function f(t, e, r) {
202
+ ((this.prev = t.context),
203
+ (this.tagName = e || ""),
204
+ (this.indent = t.indented),
205
+ (this.startOfLine = r),
206
+ (u.doNotIndent.hasOwnProperty(e) ||
207
+ (t.context && t.context.noIndent)) &&
208
+ (this.noIndent = !0));
209
+ }
210
+ function m(t) {
211
+ t.context && (t.context = t.context.prev);
212
+ }
213
+ function g(t, e) {
214
+ for (var r; ; ) {
215
+ if (!t.context) return;
216
+ if (
217
+ ((r = t.context.tagName),
218
+ !u.contextGrabbers.hasOwnProperty(c(r)) ||
219
+ !u.contextGrabbers[c(r)].hasOwnProperty(c(e)))
220
+ )
221
+ return;
222
+ m(t);
223
+ }
224
+ }
225
+ function p(t, e, r) {
226
+ return "openTag" == t
227
+ ? ((r.tagStart = e.column()), h)
228
+ : "closeTag" == t
229
+ ? x
230
+ : p;
231
+ }
232
+ function h(t, e, r) {
233
+ return "word" == t
234
+ ? ((r.tagName = e.current()), (i = "tag"), w)
235
+ : u.allowMissingTagName && "endTag" == t
236
+ ? ((i = "tag bracket"), w(t, 0, r))
237
+ : ((i = "error"), h);
238
+ }
239
+ function x(t, e, r) {
240
+ if ("word" != t)
241
+ return u.allowMissingTagName && "endTag" == t
242
+ ? ((i = "tag bracket"), b(t, 0, r))
243
+ : ((i = "error"), k);
244
+ e = e.current();
245
+ return (
246
+ r.context &&
247
+ r.context.tagName != e &&
248
+ u.implicitlyClosed.hasOwnProperty(c(r.context.tagName)) &&
249
+ m(r),
250
+ (r.context && r.context.tagName == e) || !1 === u.matchClosing
251
+ ? ((i = "tag"), b)
252
+ : ((i = "tag error"), k)
253
+ );
254
+ }
255
+ function b(t, e, r) {
256
+ return "endTag" != t ? ((i = "error"), b) : (m(r), p);
257
+ }
258
+ function k(t, e, r) {
259
+ return ((i = "error"), b(t, 0, r));
260
+ }
261
+ function w(t, e, r) {
262
+ if ("word" == t) return ((i = "attribute"), C);
263
+ if ("endTag" != t && "selfcloseTag" != t) return ((i = "error"), w);
264
+ var n = r.tagName,
265
+ o = r.tagStart;
266
+ return (
267
+ (r.tagName = r.tagStart = null),
268
+ "selfcloseTag" == t || u.autoSelfClosers.hasOwnProperty(c(n))
269
+ ? g(r, n)
270
+ : (g(r, n), (r.context = new f(r, n, o == r.indented))),
271
+ p
272
+ );
273
+ }
274
+ function C(t, e, r) {
275
+ return "equals" == t ? T : (u.allowMissing || (i = "error"), w(t, 0, r));
276
+ }
277
+ function T(t, e, r) {
278
+ return "string" == t
279
+ ? v
280
+ : "word" == t && u.allowUnquoted
281
+ ? ((i = "string"), w)
282
+ : ((i = "error"), w(t, 0, r));
283
+ }
284
+ function v(t, e, r) {
285
+ return "string" == t ? v : w(t, 0, r);
286
+ }
287
+ return (
288
+ (d.isInText = !0),
289
+ {
290
+ startState: function (t) {
291
+ var e = {
292
+ tokenize: d,
293
+ state: p,
294
+ indented: t || 0,
295
+ tagName: null,
296
+ tagStart: null,
297
+ context: null,
298
+ };
299
+ return (null != t && (e.baseIndent = t), e);
300
+ },
301
+ token: function (t, e) {
302
+ if (
303
+ (!e.tagName && t.sol() && (e.indented = t.indentation()),
304
+ t.eatSpace())
305
+ )
306
+ return null;
307
+ a = null;
308
+ var r = e.tokenize(t, e);
309
+ return (
310
+ (r || a) &&
311
+ "comment" != r &&
312
+ ((i = null),
313
+ (e.state = e.state(a || r, t, e)),
314
+ i && (r = "error" == i ? r + " error" : i)),
315
+ r
316
+ );
317
+ },
318
+ indent: function (t, e, r) {
319
+ var n = t.context;
320
+ if (t.tokenize.isInAttribute)
321
+ return t.tagStart == t.indented
322
+ ? t.stringStartCol + 1
323
+ : t.indented + l;
324
+ if (n && n.noIndent) return CodeMirror.Pass;
325
+ if (t.tokenize != s && t.tokenize != d)
326
+ return r ? r.match(/^(\s*)/)[0].length : 0;
327
+ if (t.tagName)
328
+ return !1 !== u.multilineTagIndentPastTag
329
+ ? t.tagStart + t.tagName.length + 2
330
+ : t.tagStart + l * (u.multilineTagIndentFactor || 1);
331
+ if (u.alignCDATA && /<!\[CDATA\[/.test(e)) return 0;
332
+ var o = e && /^<(\/)?([\w_:\.-]*)/.exec(e);
333
+ if (o && o[1])
334
+ for (; n; ) {
335
+ if (n.tagName == o[2]) {
336
+ n = n.prev;
337
+ break;
338
+ }
339
+ if (!u.implicitlyClosed.hasOwnProperty(c(n.tagName))) break;
340
+ n = n.prev;
341
+ }
342
+ else if (o)
343
+ for (; n; ) {
344
+ var a = u.contextGrabbers[c(n.tagName)];
345
+ if (!a || !a.hasOwnProperty(c(o[2]))) break;
346
+ n = n.prev;
347
+ }
348
+ for (; n && n.prev && !n.startOfLine; ) n = n.prev;
349
+ return n ? n.indent + l : t.baseIndent || 0;
350
+ },
351
+ electricInput: /<\/[\s\w:]+>$/,
352
+ blockCommentStart: "\x3c!--",
353
+ blockCommentEnd: "--\x3e",
354
+ configuration: u.htmlMode ? "html" : "xml",
355
+ helperType: u.htmlMode ? "html" : "xml",
356
+ skipAttribute: function (t) {
357
+ t.state == T && (t.state = w);
358
+ },
359
+ xmlCurrentTag: function (t) {
360
+ return t.tagName
361
+ ? { name: t.tagName, close: "closeTag" == t.type }
362
+ : null;
363
+ },
364
+ xmlCurrentContext: function (t) {
365
+ for (var e = [], r = t.context; r; r = r.prev) e.push(r.tagName);
366
+ return e.reverse();
367
+ },
368
+ }
369
+ );
370
+ }),
371
+ CodeMirror.defineMIME("text/xml", "xml"),
372
+ CodeMirror.defineMIME("application/xml", "xml"),
373
+ CodeMirror.mimeModes.hasOwnProperty("text/html") ||
374
+ CodeMirror.defineMIME("text/html", { name: "xml", htmlMode: !0 }));
375
+ })();
376
+ // htmlmixed
377
+ !(function () {
378
+ var l = {
379
+ script: [
380
+ ["lang", /(javascript|babel)/i, "javascript"],
381
+ [
382
+ "type",
383
+ /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,
384
+ "javascript",
385
+ ],
386
+ ["type", /./, "text/plain"],
387
+ [null, null, "javascript"],
388
+ ],
389
+ style: [
390
+ ["lang", /^css$/i, "css"],
391
+ ["type", /^(text\/)?(x-)?(stylesheet|css)$/i, "css"],
392
+ ["type", /./, "text/plain"],
393
+ [null, null, "css"],
394
+ ],
395
+ };
396
+ var a = {};
397
+ function d(t, e) {
398
+ e = t.match(
399
+ a[(e = e)] ||
400
+ (a[e] = new RegExp(
401
+ "\\s+" + e + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*",
402
+ )),
403
+ );
404
+ return e ? /^\s*(.*?)\s*$/.exec(e[2])[1] : "";
405
+ }
406
+ function m(t, e) {
407
+ return new RegExp((e ? "^" : "") + "</s*" + t + "s*>", "i");
408
+ }
409
+ function o(t, e) {
410
+ for (var a in t)
411
+ for (var n = e[a] || (e[a] = []), l = t[a], o = l.length - 1; 0 <= o; o--)
412
+ n.unshift(l[o]);
413
+ }
414
+ (CodeMirror.defineMode(
415
+ "htmlmixed",
416
+ function (i, t) {
417
+ var c = CodeMirror.getMode(i, {
418
+ name: "xml",
419
+ htmlMode: !0,
420
+ multilineTagIndentFactor: t.multilineTagIndentFactor,
421
+ multilineTagIndentPastTag: t.multilineTagIndentPastTag,
422
+ allowMissingTagName: t.allowMissingTagName,
423
+ }),
424
+ s = {},
425
+ e = t && t.tags,
426
+ a = t && t.scriptTypes;
427
+ if ((o(l, s), e && o(e, s), a))
428
+ for (var n = a.length - 1; 0 <= n; n--)
429
+ s.script.unshift(["type", a[n].matches, a[n].mode]);
430
+ function u(t, e) {
431
+ var a,
432
+ o,
433
+ r,
434
+ n = c.token(t, e.htmlState),
435
+ l = /\btag\b/.test(n);
436
+ return (
437
+ l &&
438
+ !/[<>\s\/]/.test(t.current()) &&
439
+ (a = e.htmlState.tagName && e.htmlState.tagName.toLowerCase()) &&
440
+ s.hasOwnProperty(a)
441
+ ? (e.inTag = a + " ")
442
+ : e.inTag && l && />$/.test(t.current())
443
+ ? ((a = /^([\S]+) (.*)/.exec(e.inTag)),
444
+ (e.inTag = null),
445
+ (l =
446
+ ">" == t.current() &&
447
+ (function (t, e) {
448
+ for (var a = 0; a < t.length; a++) {
449
+ var n = t[a];
450
+ if (!n[0] || n[1].test(d(e, n[0]))) return n[2];
451
+ }
452
+ })(s[a[1]], a[2])),
453
+ (l = CodeMirror.getMode(i, l)),
454
+ (o = m(a[1], !0)),
455
+ (r = m(a[1], !1)),
456
+ (e.token = function (t, e) {
457
+ return t.match(o, !1)
458
+ ? ((e.token = u), (e.localState = e.localMode = null))
459
+ : ((a = t),
460
+ (n = r),
461
+ (l = e.localMode.token(t, e.localState)),
462
+ (t = a.current()),
463
+ -1 < (e = t.search(n))
464
+ ? a.backUp(t.length - e)
465
+ : t.match(/<\/?$/) &&
466
+ (a.backUp(t.length), a.match(n, !1) || a.match(t)),
467
+ l);
468
+ var a, n, l;
469
+ }),
470
+ (e.localMode = l),
471
+ (e.localState = CodeMirror.startState(
472
+ l,
473
+ c.indent(e.htmlState, "", ""),
474
+ )))
475
+ : e.inTag &&
476
+ ((e.inTag += t.current()), t.eol() && (e.inTag += " ")),
477
+ n
478
+ );
479
+ }
480
+ return {
481
+ startState: function () {
482
+ return {
483
+ token: u,
484
+ inTag: null,
485
+ localMode: null,
486
+ localState: null,
487
+ htmlState: CodeMirror.startState(c),
488
+ };
489
+ },
490
+ copyState: function (t) {
491
+ var e;
492
+ return (
493
+ t.localState &&
494
+ (e = CodeMirror.copyState(t.localMode, t.localState)),
495
+ {
496
+ token: t.token,
497
+ inTag: t.inTag,
498
+ localMode: t.localMode,
499
+ localState: e,
500
+ htmlState: CodeMirror.copyState(c, t.htmlState),
501
+ }
502
+ );
503
+ },
504
+ token: function (t, e) {
505
+ return e.token(t, e);
506
+ },
507
+ indent: function (t, e, a) {
508
+ return !t.localMode || /^\s*<\//.test(e)
509
+ ? c.indent(t.htmlState, e, a)
510
+ : t.localMode.indent
511
+ ? t.localMode.indent(t.localState, e, a)
512
+ : CodeMirror.Pass;
513
+ },
514
+ innerMode: function (t) {
515
+ return { state: t.localState || t.htmlState, mode: t.localMode || c };
516
+ },
517
+ };
518
+ },
519
+ "xml",
520
+ "javascript",
521
+ "css",
522
+ ),
523
+ CodeMirror.defineMIME("text/html", "htmlmixed"));
524
+ })();
525
+ // yaml
526
+ (CodeMirror.defineMode("yaml", function () {
527
+ var n = new RegExp(
528
+ "\\b((" + ["true", "false", "on", "off", "yes", "no"].join(")|(") + "))$",
529
+ "i",
530
+ );
531
+ return {
532
+ token: function (e, i) {
533
+ var t = e.peek(),
534
+ r = i.escaped;
535
+ if (
536
+ ((i.escaped = !1),
537
+ "#" == t && (0 == e.pos || /\s/.test(e.string.charAt(e.pos - 1))))
538
+ )
539
+ return (e.skipToEnd(), "comment");
540
+ if (e.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/)) return "string";
541
+ if (i.literal && e.indentation() > i.keyCol)
542
+ return (e.skipToEnd(), "string");
543
+ if ((i.literal && (i.literal = !1), e.sol())) {
544
+ if (((i.keyCol = 0), (i.pair = !1), (i.pairStart = !1), e.match("---")))
545
+ return "def";
546
+ if (e.match("...")) return "def";
547
+ if (e.match(/\s*-\s+/)) return "meta";
548
+ }
549
+ if (e.match(/^(\{|\}|\[|\])/))
550
+ return (
551
+ "{" == t
552
+ ? i.inlinePairs++
553
+ : "}" == t
554
+ ? i.inlinePairs--
555
+ : "[" == t
556
+ ? i.inlineList++
557
+ : i.inlineList--,
558
+ "meta"
559
+ );
560
+ if (0 < i.inlineList && !r && "," == t) return (e.next(), "meta");
561
+ if (0 < i.inlinePairs && !r && "," == t)
562
+ return (
563
+ (i.keyCol = 0),
564
+ (i.pair = !1),
565
+ (i.pairStart = !1),
566
+ e.next(),
567
+ "meta"
568
+ );
569
+ if (i.pairStart) {
570
+ if (e.match(/^\s*(\||\>)\s*/)) return ((i.literal = !0), "meta");
571
+ if (e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) return "variable-2";
572
+ if (0 == i.inlinePairs && e.match(/^\s*-?[0-9\.\,]+\s?$/))
573
+ return "number";
574
+ if (0 < i.inlinePairs && e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))
575
+ return "number";
576
+ if (e.match(n)) return "keyword";
577
+ }
578
+ return !i.pair &&
579
+ e.match(
580
+ /^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/,
581
+ )
582
+ ? ((i.pair = !0), (i.keyCol = e.indentation()), "atom")
583
+ : i.pair && e.match(/^:\s*/)
584
+ ? ((i.pairStart = !0), "meta")
585
+ : ((i.pairStart = !1), (i.escaped = "\\" == t), e.next(), null);
586
+ },
587
+ startState: function () {
588
+ return {
589
+ pair: !1,
590
+ pairStart: !1,
591
+ keyCol: 0,
592
+ inlinePairs: 0,
593
+ inlineList: 0,
594
+ literal: !1,
595
+ escaped: !1,
596
+ };
597
+ },
598
+ lineComment: "#",
599
+ fold: "indent",
600
+ };
601
+ }),
602
+ CodeMirror.defineMIME("text/x-yaml", "yaml"),
603
+ CodeMirror.defineMIME("text/yaml", "yaml"));
604
+
605
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
606
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
607
+
608
+ (function (mod) {
609
+ if (typeof exports == "object" && typeof module == "object")
610
+ // CommonJS
611
+ mod(
612
+ require("../../lib/codemirror"),
613
+ require("../xml/xml"),
614
+ require("../meta"),
615
+ );
616
+ else if (typeof define == "function" && define.amd)
617
+ // AMD
618
+ define(["../../lib/codemirror", "../xml/xml", "../meta"], mod); // Plain browser env
619
+ else mod(CodeMirror);
620
+ })(function (CodeMirror) {
621
+ "use strict";
622
+
623
+ CodeMirror.defineMode(
624
+ "markdown",
625
+ function (cmCfg, modeCfg) {
626
+ var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
627
+ var htmlModeMissing = htmlMode.name == "null";
628
+
629
+ function getMode(name) {
630
+ if (CodeMirror.findModeByName) {
631
+ var found = CodeMirror.findModeByName(name);
632
+ if (found) name = found.mime || found.mimes[0];
633
+ }
634
+ var mode = CodeMirror.getMode(cmCfg, name);
635
+ return mode.name == "null" ? null : mode;
636
+ }
637
+
638
+ // Should characters that affect highlighting be highlighted separate?
639
+ // Does not include characters that will be output (such as `1.` and `-` for lists)
640
+ if (modeCfg.highlightFormatting === undefined)
641
+ modeCfg.highlightFormatting = false;
642
+
643
+ // Maximum number of nested blockquotes. Set to 0 for infinite nesting.
644
+ // Excess `>` will emit `error` token.
645
+ if (modeCfg.maxBlockquoteDepth === undefined)
646
+ modeCfg.maxBlockquoteDepth = 0;
647
+
648
+ // Turn on task lists? ("- [ ] " and "- [x] ")
649
+ if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
650
+
651
+ // Turn on strikethrough syntax
652
+ if (modeCfg.strikethrough === undefined) modeCfg.strikethrough = false;
653
+
654
+ if (modeCfg.emoji === undefined) modeCfg.emoji = false;
655
+
656
+ if (modeCfg.fencedCodeBlockHighlighting === undefined)
657
+ modeCfg.fencedCodeBlockHighlighting = true;
658
+
659
+ if (modeCfg.xml === undefined) modeCfg.xml = true;
660
+
661
+ // Allow token types to be overridden by user-provided token types.
662
+ if (modeCfg.tokenTypeOverrides === undefined)
663
+ modeCfg.tokenTypeOverrides = {};
664
+
665
+ var tokenTypes = {
666
+ header: "header",
667
+ code: "comment",
668
+ quote: "quote",
669
+ list1: "variable-2",
670
+ list2: "variable-3",
671
+ list3: "keyword",
672
+ hr: "hr",
673
+ image: "image",
674
+ imageAltText: "image-alt-text",
675
+ imageMarker: "image-marker",
676
+ formatting: "formatting",
677
+ linkInline: "link",
678
+ linkEmail: "link",
679
+ linkText: "link",
680
+ linkHref: "string",
681
+ em: "em",
682
+ strong: "strong",
683
+ strikethrough: "strikethrough",
684
+ emoji: "builtin",
685
+ highlight: "highlight",
686
+ };
687
+
688
+ for (var tokenType in tokenTypes) {
689
+ if (
690
+ tokenTypes.hasOwnProperty(tokenType) &&
691
+ modeCfg.tokenTypeOverrides[tokenType]
692
+ ) {
693
+ tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
694
+ }
695
+ }
696
+
697
+ var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/,
698
+ listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/,
699
+ taskListRE = /^\[(.)\](?=\s)/i, // Must follow listRE
700
+ atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace
701
+ ? /^(#+)/
702
+ : /^(#+)(?: |$)/,
703
+ setextHeaderRE = /^ {0,3}(?:\={1,}|-{2,})\s*$/,
704
+ textRE = /^[^#!\[\]*_\\<>` "'(~:=|$%^]+/,
705
+ fencedCodeRE = /^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,
706
+ linkDefRE = /^\s*\[[^\]]+?\]:.*$/, // naive link-definition
707
+ punctuation =
708
+ /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,
709
+ expandedTab = " ", // CommonMark specifies tab as 4 spaces
710
+ escapableRE = /^[\\`*{}\[\]()#+-.!_>~|\n"$%&',\/:;<=?@^]/; // escapable chars as defined by CommonMark
711
+
712
+ function switchInline(stream, state, f) {
713
+ state.f = state.inline = f;
714
+ return f(stream, state);
715
+ }
716
+
717
+ function switchBlock(stream, state, f) {
718
+ state.f = state.block = f;
719
+ return f(stream, state);
720
+ }
721
+
722
+ function lineIsEmpty(line) {
723
+ return !line || !/\S/.test(line.string);
724
+ }
725
+
726
+ // Blocks
727
+
728
+ function blankLine(state) {
729
+ // Reset linkTitle state
730
+ state.linkTitle = false;
731
+ state.linkHref = false;
732
+ state.linkText = false;
733
+ // Reset EM state
734
+ state.em = false;
735
+ // Reset STRONG state
736
+ state.strong = false;
737
+ // Reset strikethrough state
738
+ state.strikethrough = false;
739
+ // Reset highlight state
740
+ state.highlight = false;
741
+ // Reset state.quote
742
+ state.quote = 0;
743
+ // Reset state.indentedCode
744
+ state.indentedCode = false;
745
+ if (state.f == htmlBlock) {
746
+ var exit = htmlModeMissing;
747
+ if (!exit) {
748
+ var inner = CodeMirror.innerMode(htmlMode, state.htmlState);
749
+ exit =
750
+ inner.mode.name == "xml" &&
751
+ inner.state.tagStart === null &&
752
+ !inner.state.context &&
753
+ inner.state.tokenize.isInText;
754
+ }
755
+ if (exit) {
756
+ state.f = inlineNormal;
757
+ state.block = blockNormal;
758
+ state.htmlState = null;
759
+ }
760
+ }
761
+ // Reset state.trailingSpace
762
+ state.trailingSpace = 0;
763
+ state.trailingSpaceNewLine = false;
764
+ // Mark this line as blank
765
+ state.prevLine = state.thisLine;
766
+ state.thisLine = { stream: null };
767
+ return null;
768
+ }
769
+
770
+ function blockNormal(stream, state) {
771
+ var firstTokenOnLine = stream.column() === state.indentation;
772
+ var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
773
+ var prevLineIsIndentedCode = state.indentedCode;
774
+ var prevLineIsHr = state.prevLine.hr;
775
+ var prevLineIsList = state.list !== false;
776
+ var maxNonCodeIndentation =
777
+ (state.listStack[state.listStack.length - 1] || 0) + 3;
778
+
779
+ state.indentedCode = false;
780
+
781
+ var lineIndentation = state.indentation;
782
+ // compute once per line (on first token)
783
+ if (state.indentationDiff === null) {
784
+ state.indentationDiff = state.indentation;
785
+ if (prevLineIsList) {
786
+ state.list = null;
787
+ // While this list item's marker's indentation is less than the deepest
788
+ // list item's content's indentation,pop the deepest list item
789
+ // indentation off the stack, and update block indentation state
790
+ while (
791
+ lineIndentation < state.listStack[state.listStack.length - 1]
792
+ ) {
793
+ state.listStack.pop();
794
+ if (state.listStack.length) {
795
+ state.indentation = state.listStack[state.listStack.length - 1];
796
+ // less than the first list's indent -> the line is no longer a list
797
+ } else {
798
+ state.list = false;
799
+ }
800
+ }
801
+ if (state.list !== false) {
802
+ state.indentationDiff =
803
+ lineIndentation - state.listStack[state.listStack.length - 1];
804
+ }
805
+ }
806
+ }
807
+
808
+ // not comprehensive (currently only for setext detection purposes)
809
+ var allowsInlineContinuation =
810
+ !prevLineLineIsEmpty &&
811
+ !prevLineIsHr &&
812
+ !state.prevLine.header &&
813
+ (!prevLineIsList || !prevLineIsIndentedCode) &&
814
+ !state.prevLine.fencedCodeEnd;
815
+
816
+ var isHr =
817
+ (state.list === false || prevLineIsHr || prevLineLineIsEmpty) &&
818
+ state.indentation <= maxNonCodeIndentation &&
819
+ stream.match(hrRE);
820
+
821
+ var match = null;
822
+ if (
823
+ state.indentationDiff >= 4 &&
824
+ (prevLineIsIndentedCode ||
825
+ state.prevLine.fencedCodeEnd ||
826
+ state.prevLine.header ||
827
+ prevLineLineIsEmpty)
828
+ ) {
829
+ stream.skipToEnd();
830
+ state.indentedCode = true;
831
+ return tokenTypes.code;
832
+ } else if (stream.eatSpace()) {
833
+ return null;
834
+ } else if (
835
+ firstTokenOnLine &&
836
+ state.indentation <= maxNonCodeIndentation &&
837
+ (match = stream.match(atxHeaderRE)) &&
838
+ match[1].length <= 6
839
+ ) {
840
+ state.quote = 0;
841
+ state.header = match[1].length;
842
+ state.thisLine.header = true;
843
+ if (modeCfg.highlightFormatting) state.formatting = "header";
844
+ state.f = state.inline;
845
+ return getType(state);
846
+ } else if (
847
+ state.indentation <= maxNonCodeIndentation &&
848
+ stream.eat(">")
849
+ ) {
850
+ state.quote = firstTokenOnLine ? 1 : state.quote + 1;
851
+ if (modeCfg.highlightFormatting) state.formatting = "quote";
852
+ stream.eatSpace();
853
+ return getType(state);
854
+ } else if (
855
+ !isHr &&
856
+ !state.setext &&
857
+ firstTokenOnLine &&
858
+ state.indentation <= maxNonCodeIndentation &&
859
+ (match = stream.match(listRE))
860
+ ) {
861
+ var listType = match[1] ? "ol" : "ul";
862
+
863
+ state.indentation = lineIndentation + stream.current().length;
864
+ state.list = true;
865
+ state.quote = 0;
866
+
867
+ // Add this list item's content's indentation to the stack
868
+ state.listStack.push(state.indentation);
869
+ // Reset inline styles which shouldn't propagate across list items
870
+ state.em = false;
871
+ state.strong = false;
872
+ state.code = false;
873
+ state.strikethrough = false;
874
+ state.highlight = false;
875
+
876
+ if (modeCfg.taskLists && stream.match(taskListRE, false)) {
877
+ state.taskList = true;
878
+ }
879
+ state.f = state.inline;
880
+ if (modeCfg.highlightFormatting)
881
+ state.formatting = ["list", "list-" + listType];
882
+ return getType(state);
883
+ } else if (
884
+ firstTokenOnLine &&
885
+ state.indentation <= maxNonCodeIndentation &&
886
+ (match = stream.match(fencedCodeRE, true))
887
+ ) {
888
+ state.quote = 0;
889
+ state.fencedEndRE = new RegExp(match[1] + "+ *$");
890
+ // try switching mode
891
+ state.localMode =
892
+ modeCfg.fencedCodeBlockHighlighting && getMode(match[2]);
893
+ if (state.localMode)
894
+ state.localState = CodeMirror.startState(state.localMode);
895
+ state.f = state.block = local;
896
+ if (modeCfg.highlightFormatting) state.formatting = "code-block";
897
+ state.code = -1;
898
+ return getType(state);
899
+ // SETEXT has lowest block-scope precedence after HR, so check it after
900
+ // the others (code, blockquote, list...)
901
+ } else if (
902
+ // if setext set, indicates line after ---/===
903
+ state.setext ||
904
+ // line before ---/===
905
+ ((!allowsInlineContinuation || !prevLineIsList) &&
906
+ !state.quote &&
907
+ state.list === false &&
908
+ !state.code &&
909
+ !isHr &&
910
+ !linkDefRE.test(stream.string) &&
911
+ (match = stream.lookAhead(1)) &&
912
+ (match = match.match(setextHeaderRE)))
913
+ ) {
914
+ if (!state.setext) {
915
+ state.header = match[0].charAt(0) == "=" ? 1 : 2;
916
+ state.setext = state.header;
917
+ } else {
918
+ state.header = state.setext;
919
+ // has no effect on type so we can reset it now
920
+ state.setext = 0;
921
+ stream.skipToEnd();
922
+ if (modeCfg.highlightFormatting) state.formatting = "header";
923
+ }
924
+ state.thisLine.header = true;
925
+ state.f = state.inline;
926
+ return getType(state);
927
+ } else if (isHr) {
928
+ stream.skipToEnd();
929
+ state.hr = true;
930
+ state.thisLine.hr = true;
931
+ return tokenTypes.hr;
932
+ } else if (stream.peek() === "[") {
933
+ return switchInline(stream, state, footnoteLink);
934
+ }
935
+
936
+ return switchInline(stream, state, state.inline);
937
+ }
938
+
939
+ function htmlBlock(stream, state) {
940
+ var style = htmlMode.token(stream, state.htmlState);
941
+ if (!htmlModeMissing) {
942
+ var inner = CodeMirror.innerMode(htmlMode, state.htmlState);
943
+ if (
944
+ (inner.mode.name == "xml" &&
945
+ inner.state.tagStart === null &&
946
+ !inner.state.context &&
947
+ inner.state.tokenize.isInText) ||
948
+ (state.md_inside && stream.current().indexOf(">") > -1)
949
+ ) {
950
+ state.f = inlineNormal;
951
+ state.block = blockNormal;
952
+ state.htmlState = null;
953
+ }
954
+ }
955
+ return style;
956
+ }
957
+
958
+ function local(stream, state) {
959
+ var currListInd = state.listStack[state.listStack.length - 1] || 0;
960
+ var hasExitedList = state.indentation < currListInd;
961
+ var maxFencedEndInd = currListInd + 3;
962
+ if (
963
+ state.fencedEndRE &&
964
+ state.indentation <= maxFencedEndInd &&
965
+ (hasExitedList || stream.match(state.fencedEndRE))
966
+ ) {
967
+ if (modeCfg.highlightFormatting) state.formatting = "code-block";
968
+ var returnType;
969
+ if (!hasExitedList) returnType = getType(state);
970
+ state.localMode = state.localState = null;
971
+ state.block = blockNormal;
972
+ state.f = inlineNormal;
973
+ state.fencedEndRE = null;
974
+ state.code = 0;
975
+ state.thisLine.fencedCodeEnd = true;
976
+ if (hasExitedList) return switchBlock(stream, state, state.block);
977
+ return returnType;
978
+ } else if (state.localMode) {
979
+ return state.localMode.token(stream, state.localState);
980
+ } else {
981
+ stream.skipToEnd();
982
+ return tokenTypes.code;
983
+ }
984
+ }
985
+
986
+ // Inline
987
+ function getType(state) {
988
+ var styles = [];
989
+
990
+ if (state.formatting) {
991
+ styles.push(tokenTypes.formatting);
992
+
993
+ if (typeof state.formatting === "string")
994
+ state.formatting = [state.formatting];
995
+
996
+ for (var i = 0; i < state.formatting.length; i++) {
997
+ styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
998
+
999
+ if (state.formatting[i] === "header") {
1000
+ styles.push(
1001
+ tokenTypes.formatting +
1002
+ "-" +
1003
+ state.formatting[i] +
1004
+ "-" +
1005
+ state.header,
1006
+ );
1007
+ }
1008
+
1009
+ // Add `formatting-quote` and `formatting-quote-#` for blockquotes
1010
+ // Add `error` instead if the maximum blockquote nesting depth is passed
1011
+ if (state.formatting[i] === "quote") {
1012
+ if (
1013
+ !modeCfg.maxBlockquoteDepth ||
1014
+ modeCfg.maxBlockquoteDepth >= state.quote
1015
+ ) {
1016
+ styles.push(
1017
+ tokenTypes.formatting +
1018
+ "-" +
1019
+ state.formatting[i] +
1020
+ "-" +
1021
+ state.quote,
1022
+ );
1023
+ } else {
1024
+ styles.push("error");
1025
+ }
1026
+ }
1027
+ }
1028
+ }
1029
+
1030
+ if (state.taskOpen) {
1031
+ styles.push("meta");
1032
+ return styles.length ? styles.join(" ") : null;
1033
+ }
1034
+ if (state.taskClosed) {
1035
+ styles.push("property");
1036
+ return styles.length ? styles.join(" ") : null;
1037
+ }
1038
+
1039
+ // if (state.linkHref) {
1040
+ // styles.push(tokenTypes.linkHref, "url");
1041
+ // } else { // Only apply inline styles to non-url text
1042
+ if (state.linkHref) {
1043
+ styles.push(tokenTypes.linkHref, "url");
1044
+ }
1045
+ if (state.strong) {
1046
+ styles.push(tokenTypes.strong);
1047
+ }
1048
+ if (state.em) {
1049
+ styles.push(tokenTypes.em);
1050
+ }
1051
+ if (state.strikethrough) {
1052
+ styles.push(tokenTypes.strikethrough);
1053
+ }
1054
+ if (state.highlight) {
1055
+ styles.push(tokenTypes.highlight);
1056
+ }
1057
+ if (state.emoji) {
1058
+ styles.push(tokenTypes.emoji);
1059
+ }
1060
+ if (state.linkText) {
1061
+ styles.push(tokenTypes.linkText);
1062
+ }
1063
+ if (state.code) {
1064
+ styles.push(tokenTypes.code);
1065
+ }
1066
+ if (state.image) {
1067
+ styles.push(tokenTypes.image);
1068
+ }
1069
+ if (state.imageAltText) {
1070
+ styles.push(tokenTypes.imageAltText, "link");
1071
+ }
1072
+ if (state.imageMarker) {
1073
+ styles.push(tokenTypes.imageMarker);
1074
+ }
1075
+ // }
1076
+
1077
+ if (state.header) {
1078
+ styles.push(
1079
+ tokenTypes.header,
1080
+ tokenTypes.header + "-" + state.header,
1081
+ );
1082
+ }
1083
+
1084
+ if (state.quote) {
1085
+ styles.push(tokenTypes.quote);
1086
+
1087
+ // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
1088
+ if (
1089
+ !modeCfg.maxBlockquoteDepth ||
1090
+ modeCfg.maxBlockquoteDepth >= state.quote
1091
+ ) {
1092
+ styles.push(tokenTypes.quote + "-" + state.quote);
1093
+ } else {
1094
+ styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
1095
+ }
1096
+ }
1097
+
1098
+ if (state.list !== false) {
1099
+ var listMod = (state.listStack.length - 1) % 3;
1100
+ if (!listMod) {
1101
+ styles.push(tokenTypes.list1);
1102
+ } else if (listMod === 1) {
1103
+ styles.push(tokenTypes.list2);
1104
+ } else {
1105
+ styles.push(tokenTypes.list3);
1106
+ }
1107
+ }
1108
+
1109
+ if (state.trailingSpaceNewLine) {
1110
+ styles.push("trailing-space-new-line");
1111
+ } else if (state.trailingSpace) {
1112
+ styles.push(
1113
+ "trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"),
1114
+ );
1115
+ }
1116
+
1117
+ return styles.length ? styles.join(" ") : null;
1118
+ }
1119
+
1120
+ function handleText(stream, state) {
1121
+ if (stream.match(textRE, true)) {
1122
+ return getType(state);
1123
+ }
1124
+ return undefined;
1125
+ }
1126
+
1127
+ function inlineNormal(stream, state) {
1128
+ var style = state.text(stream, state);
1129
+ if (typeof style !== "undefined") return style;
1130
+
1131
+ // fix " - [[link]]" not working as it returns too early
1132
+ if (state.list && !state.internalLink) {
1133
+ // List marker (*, +, -, 1., etc)
1134
+ state.list = null;
1135
+ return getType(state);
1136
+ }
1137
+
1138
+ if (state.taskList) {
1139
+ var match = stream.match(taskListRE, true);
1140
+ state.taskList = false;
1141
+ if (match) {
1142
+ var taskOpen = match[1] === " ";
1143
+ if (taskOpen) state.taskOpen = true;
1144
+ else state.taskClosed = true;
1145
+ if (modeCfg.highlightFormatting) state.formatting = "task";
1146
+ return getType(state);
1147
+ }
1148
+ }
1149
+
1150
+ state.taskOpen = false;
1151
+ state.taskClosed = false;
1152
+
1153
+ if (state.header && stream.match(/^#+$/, true)) {
1154
+ if (modeCfg.highlightFormatting) state.formatting = "header";
1155
+ return getType(state);
1156
+ }
1157
+
1158
+ var ch = stream.next();
1159
+
1160
+ // Matches link titles present on next line
1161
+ if (state.linkTitle) {
1162
+ state.linkTitle = false;
1163
+ var matchCh = ch;
1164
+ if (ch === "(") {
1165
+ matchCh = ")";
1166
+ }
1167
+ matchCh = (matchCh + "").replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
1168
+ var regex =
1169
+ "^\\s*(?:[^" + matchCh + "\\\\]+|\\\\\\\\|\\\\.)" + matchCh;
1170
+ if (stream.match(new RegExp(regex), true)) {
1171
+ return tokenTypes.linkHref;
1172
+ }
1173
+ }
1174
+
1175
+ // If this block is changed, it may need to be updated in GFM mode
1176
+ if (ch === "`") {
1177
+ var previousFormatting = state.formatting;
1178
+ if (modeCfg.highlightFormatting) state.formatting = "code";
1179
+ stream.eatWhile("`");
1180
+ var count = stream.current().length;
1181
+ if (state.code == 0 && (!state.quote || count == 1)) {
1182
+ state.code = count;
1183
+ return getType(state);
1184
+ } else if (count == state.code) {
1185
+ // Must be exact
1186
+ var t = getType(state);
1187
+ state.code = 0;
1188
+ return t;
1189
+ } else {
1190
+ state.formatting = previousFormatting;
1191
+ return getType(state);
1192
+ }
1193
+ } else if (state.code) {
1194
+ return getType(state);
1195
+ }
1196
+
1197
+ if (ch === "\\") {
1198
+ if (stream.match(escapableRE, true) && modeCfg.highlightFormatting) {
1199
+ var type = getType(state);
1200
+ var formattingEscape = tokenTypes.formatting + "-escape";
1201
+ return type ? type + " " + formattingEscape : formattingEscape;
1202
+ }
1203
+ }
1204
+
1205
+ if (ch === "!" && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
1206
+ state.imageMarker = true;
1207
+ state.image = true;
1208
+ if (modeCfg.highlightFormatting) state.formatting = "image";
1209
+ return getType(state);
1210
+ }
1211
+
1212
+ if (
1213
+ ch === "[" &&
1214
+ state.imageMarker &&
1215
+ stream.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/, false)
1216
+ ) {
1217
+ state.imageMarker = false;
1218
+ state.imageAltText = true;
1219
+ if (modeCfg.highlightFormatting) state.formatting = "image";
1220
+ return getType(state);
1221
+ }
1222
+
1223
+ if (ch === "]" && state.imageAltText) {
1224
+ if (modeCfg.highlightFormatting) state.formatting = "image";
1225
+ var type = getType(state);
1226
+ state.imageAltText = false;
1227
+ state.image = false;
1228
+ state.inline = state.f = linkHref;
1229
+ return type;
1230
+ }
1231
+
1232
+ if (ch === "[" && !state.image && !state.internalLink) {
1233
+ if (state.linkText && stream.match(/^.*?\]/)) return getType(state);
1234
+ state.linkText = true;
1235
+ if (modeCfg.highlightFormatting) state.formatting = "link";
1236
+ return getType(state);
1237
+ }
1238
+
1239
+ if (ch === "]" && state.linkText) {
1240
+ if (modeCfg.highlightFormatting) state.formatting = "link";
1241
+ var type = getType(state);
1242
+ state.linkText = false;
1243
+ state.inline = state.f = stream.match(/\(.*?\)| ?\[.*?\]/, false)
1244
+ ? linkHref
1245
+ : inlineNormal;
1246
+ return type;
1247
+ }
1248
+
1249
+ if (
1250
+ ch === "<" &&
1251
+ stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)
1252
+ ) {
1253
+ state.f = state.inline = linkInline;
1254
+ if (modeCfg.highlightFormatting) state.formatting = "link";
1255
+ var type = getType(state);
1256
+ if (type) {
1257
+ type += " ";
1258
+ } else {
1259
+ type = "";
1260
+ }
1261
+ return type + tokenTypes.linkInline;
1262
+ }
1263
+
1264
+ if (ch === "<" && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
1265
+ state.f = state.inline = linkInline;
1266
+ if (modeCfg.highlightFormatting) state.formatting = "link";
1267
+ var type = getType(state);
1268
+ if (type) {
1269
+ type += " ";
1270
+ } else {
1271
+ type = "";
1272
+ }
1273
+ return type + tokenTypes.linkEmail;
1274
+ }
1275
+
1276
+ if (
1277
+ modeCfg.xml &&
1278
+ ch === "<" &&
1279
+ stream.match(
1280
+ /^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,
1281
+ false,
1282
+ )
1283
+ ) {
1284
+ var end = stream.string.indexOf(">", stream.pos);
1285
+ if (end != -1) {
1286
+ var atts = stream.string.substring(stream.start, end);
1287
+ if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts))
1288
+ state.md_inside = true;
1289
+ }
1290
+ stream.backUp(1);
1291
+ state.htmlState = CodeMirror.startState(htmlMode);
1292
+ return switchBlock(stream, state, htmlBlock);
1293
+ }
1294
+
1295
+ if (modeCfg.xml && ch === "<" && stream.match(/^\/\w*?>/)) {
1296
+ state.md_inside = false;
1297
+ return "tag";
1298
+ } else if (ch === "*" || ch === "_") {
1299
+ var len = 1,
1300
+ before =
1301
+ stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2);
1302
+ while (len < 3 && stream.eat(ch)) len++;
1303
+ var after = stream.peek() || " ";
1304
+ // See http://spec.commonmark.org/0.27/#emphasis-and-strong-emphasis
1305
+ var leftFlanking =
1306
+ !/\s/.test(after) &&
1307
+ (!punctuation.test(after) ||
1308
+ /\s/.test(before) ||
1309
+ punctuation.test(before));
1310
+ var rightFlanking =
1311
+ !/\s/.test(before) &&
1312
+ (!punctuation.test(before) ||
1313
+ /\s/.test(after) ||
1314
+ punctuation.test(after));
1315
+ var setEm = null,
1316
+ setStrong = null;
1317
+ if (len % 2) {
1318
+ // Em
1319
+ if (
1320
+ !state.em &&
1321
+ leftFlanking &&
1322
+ (ch === "*" || !rightFlanking || punctuation.test(before))
1323
+ )
1324
+ setEm = true;
1325
+ else if (
1326
+ state.em == ch &&
1327
+ rightFlanking &&
1328
+ (ch === "*" || !leftFlanking || punctuation.test(after))
1329
+ )
1330
+ setEm = false;
1331
+ }
1332
+ if (len > 1) {
1333
+ // Strong
1334
+ if (
1335
+ !state.strong &&
1336
+ leftFlanking &&
1337
+ (ch === "*" || !rightFlanking || punctuation.test(before))
1338
+ )
1339
+ setStrong = true;
1340
+ else if (
1341
+ state.strong == ch &&
1342
+ rightFlanking &&
1343
+ (ch === "*" || !leftFlanking || punctuation.test(after))
1344
+ )
1345
+ setStrong = false;
1346
+ }
1347
+ if (setStrong != null || setEm != null) {
1348
+ if (modeCfg.highlightFormatting)
1349
+ state.formatting =
1350
+ setEm == null
1351
+ ? "strong"
1352
+ : setStrong == null
1353
+ ? "em"
1354
+ : "strong em";
1355
+ if (setEm === true) state.em = ch;
1356
+ if (setStrong === true) state.strong = ch;
1357
+ var t = getType(state);
1358
+ if (setEm === false) state.em = false;
1359
+ if (setStrong === false) state.strong = false;
1360
+ return t;
1361
+ }
1362
+ } else if (ch === " ") {
1363
+ if (stream.eat("*") || stream.eat("_")) {
1364
+ // Probably surrounded by spaces
1365
+ if (stream.peek() === " ") {
1366
+ // Surrounded by spaces, ignore
1367
+ return getType(state);
1368
+ } else {
1369
+ // Not surrounded by spaces, back up pointer
1370
+ stream.backUp(1);
1371
+ }
1372
+ }
1373
+ }
1374
+
1375
+ if (modeCfg.highlight) {
1376
+ if (ch === "=" && stream.eatWhile(ch)) {
1377
+ if (state.highlight) {
1378
+ // Remove highlight
1379
+ if (modeCfg.highlightFormatting) state.formatting = "highlight";
1380
+ var t = getType(state);
1381
+ state.highlight = false;
1382
+ return t;
1383
+ } else if (stream.match(/^[^\s>]/, false)) {
1384
+ // Add highlight
1385
+ state.highlight = true;
1386
+ if (modeCfg.highlightFormatting) state.formatting = "highlight";
1387
+ return getType(state);
1388
+ }
1389
+ } else if (ch === " ") {
1390
+ if (stream.match(/^==/, true)) {
1391
+ // Probably surrounded by space
1392
+ if (stream.peek() === " ") {
1393
+ // Surrounded by spaces, ignore
1394
+ return getType(state);
1395
+ } else {
1396
+ // Not surrounded by spaces, back up pointer
1397
+ stream.backUp(2);
1398
+ }
1399
+ }
1400
+ }
1401
+ }
1402
+
1403
+ if (modeCfg.strikethrough) {
1404
+ if (ch === "~" && stream.eatWhile(ch)) {
1405
+ if (state.strikethrough) {
1406
+ // Remove strikethrough
1407
+ if (modeCfg.highlightFormatting)
1408
+ state.formatting = "strikethrough";
1409
+ var t = getType(state);
1410
+ state.strikethrough = false;
1411
+ return t;
1412
+ } else if (stream.match(/^[^\s]/, false)) {
1413
+ // Add strikethrough
1414
+ state.strikethrough = true;
1415
+ if (modeCfg.highlightFormatting)
1416
+ state.formatting = "strikethrough";
1417
+ return getType(state);
1418
+ }
1419
+ } else if (ch === " ") {
1420
+ if (stream.match("~~", true)) {
1421
+ // Probably surrounded by space
1422
+ if (stream.peek() === " ") {
1423
+ // Surrounded by spaces, ignore
1424
+ return getType(state);
1425
+ } else {
1426
+ // Not surrounded by spaces, back up pointer
1427
+ stream.backUp(2);
1428
+ }
1429
+ }
1430
+ }
1431
+ }
1432
+
1433
+ if (
1434
+ modeCfg.emoji &&
1435
+ ch === ":" &&
1436
+ stream.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)
1437
+ ) {
1438
+ state.emoji = true;
1439
+ if (modeCfg.highlightFormatting) state.formatting = "emoji";
1440
+ var retType = getType(state);
1441
+ state.emoji = false;
1442
+ return retType;
1443
+ }
1444
+
1445
+ if (ch === " ") {
1446
+ if (stream.match(/^ +$/, false)) {
1447
+ state.trailingSpace++;
1448
+ } else if (state.trailingSpace) {
1449
+ state.trailingSpaceNewLine = true;
1450
+ }
1451
+ }
1452
+
1453
+ return getType(state);
1454
+ }
1455
+
1456
+ function linkInline(stream, state) {
1457
+ var ch = stream.next();
1458
+
1459
+ if (ch === ">") {
1460
+ state.f = state.inline = inlineNormal;
1461
+ if (modeCfg.highlightFormatting) state.formatting = "link";
1462
+ var type = getType(state);
1463
+ if (type) {
1464
+ type += " ";
1465
+ } else {
1466
+ type = "";
1467
+ }
1468
+ return type + tokenTypes.linkInline;
1469
+ }
1470
+
1471
+ stream.match(/^[^>]+/, true);
1472
+
1473
+ return tokenTypes.linkInline;
1474
+ }
1475
+
1476
+ function linkHref(stream, state) {
1477
+ // Check if space, and return NULL if so (to avoid marking the space)
1478
+ if (stream.eatSpace()) {
1479
+ return null;
1480
+ }
1481
+ var ch = stream.next();
1482
+ if (ch === "(" || ch === "[") {
1483
+ state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
1484
+ if (modeCfg.highlightFormatting) state.formatting = "link-string";
1485
+ state.linkHref = true;
1486
+ return getType(state);
1487
+ }
1488
+ return "error";
1489
+ }
1490
+
1491
+ var linkRE = {
1492
+ ")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
1493
+ "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/,
1494
+ };
1495
+
1496
+ function getLinkHrefInside(endChar) {
1497
+ return function (stream, state) {
1498
+ var ch = stream.next();
1499
+
1500
+ if (ch === endChar) {
1501
+ state.f = state.inline = inlineNormal;
1502
+ if (modeCfg.highlightFormatting) state.formatting = "link-string";
1503
+ var returnState = getType(state);
1504
+ state.linkHref = false;
1505
+ return returnState;
1506
+ }
1507
+
1508
+ stream.match(linkRE[endChar]);
1509
+ state.linkHref = true;
1510
+ return getType(state);
1511
+ };
1512
+ }
1513
+
1514
+ function footnoteLink(stream, state) {
1515
+ if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
1516
+ state.f = footnoteLinkInside;
1517
+ stream.next(); // Consume [
1518
+ if (modeCfg.highlightFormatting) state.formatting = "link";
1519
+ state.linkText = true;
1520
+ return getType(state);
1521
+ }
1522
+ return switchInline(stream, state, inlineNormal);
1523
+ }
1524
+
1525
+ function footnoteLinkInside(stream, state) {
1526
+ if (stream.match("]:", true)) {
1527
+ state.f = state.inline = footnoteUrl;
1528
+ if (modeCfg.highlightFormatting) state.formatting = "link";
1529
+ var returnType = getType(state);
1530
+ state.linkText = false;
1531
+ return returnType;
1532
+ }
1533
+
1534
+ stream.match(/^([^\]\\]|\\.)+/, true);
1535
+
1536
+ return tokenTypes.linkText;
1537
+ }
1538
+
1539
+ function footnoteUrl(stream, state) {
1540
+ // Check if space, and return NULL if so (to avoid marking the space)
1541
+ if (stream.eatSpace()) {
1542
+ return null;
1543
+ }
1544
+ // Match URL
1545
+ stream.match(/^[^\s]+/, true);
1546
+ // Check for link title
1547
+ if (stream.peek() === undefined) {
1548
+ // End of line, set flag to check next line
1549
+ state.linkTitle = true;
1550
+ } else {
1551
+ // More content on line, check if link title
1552
+ stream.match(
1553
+ /^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,
1554
+ true,
1555
+ );
1556
+ }
1557
+ state.f = state.inline = inlineNormal;
1558
+ return tokenTypes.linkHref + " url";
1559
+ }
1560
+
1561
+ var mode = {
1562
+ startState: function () {
1563
+ return {
1564
+ f: blockNormal,
1565
+
1566
+ prevLine: { stream: null },
1567
+ thisLine: { stream: null },
1568
+
1569
+ block: blockNormal,
1570
+ htmlState: null,
1571
+ indentation: 0,
1572
+
1573
+ inline: inlineNormal,
1574
+ text: handleText,
1575
+
1576
+ formatting: false,
1577
+ linkText: false,
1578
+ linkHref: false,
1579
+ linkTitle: false,
1580
+ code: 0,
1581
+ em: false,
1582
+ strong: false,
1583
+ header: 0,
1584
+ setext: 0,
1585
+ hr: false,
1586
+ taskList: false,
1587
+ list: false,
1588
+ listStack: [],
1589
+ quote: 0,
1590
+ trailingSpace: 0,
1591
+ trailingSpaceNewLine: false,
1592
+ strikethrough: false,
1593
+ highlight: false,
1594
+ emoji: false,
1595
+ fencedEndRE: null,
1596
+ };
1597
+ },
1598
+
1599
+ copyState: function (s) {
1600
+ return {
1601
+ f: s.f,
1602
+
1603
+ prevLine: s.prevLine,
1604
+ thisLine: s.thisLine,
1605
+
1606
+ block: s.block,
1607
+ htmlState:
1608
+ s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
1609
+ indentation: s.indentation,
1610
+
1611
+ localMode: s.localMode,
1612
+ localState: s.localMode
1613
+ ? CodeMirror.copyState(s.localMode, s.localState)
1614
+ : null,
1615
+
1616
+ inline: s.inline,
1617
+ text: s.text,
1618
+ formatting: false,
1619
+ linkText: s.linkText,
1620
+ linkTitle: s.linkTitle,
1621
+ linkHref: s.linkHref,
1622
+ code: s.code,
1623
+ em: s.em,
1624
+ strong: s.strong,
1625
+ strikethrough: s.strikethrough,
1626
+ highlight: s.highlight,
1627
+ emoji: s.emoji,
1628
+ header: s.header,
1629
+ setext: s.setext,
1630
+ hr: s.hr,
1631
+ taskList: s.taskList,
1632
+ list: s.list,
1633
+ listStack: s.listStack.slice(0),
1634
+ quote: s.quote,
1635
+ indentedCode: s.indentedCode,
1636
+ trailingSpace: s.trailingSpace,
1637
+ trailingSpaceNewLine: s.trailingSpaceNewLine,
1638
+ md_inside: s.md_inside,
1639
+ fencedEndRE: s.fencedEndRE,
1640
+ };
1641
+ },
1642
+
1643
+ token: function (stream, state) {
1644
+ // Reset state.formatting
1645
+ state.formatting = false;
1646
+
1647
+ if (stream != state.thisLine.stream) {
1648
+ state.header = 0;
1649
+ state.hr = false;
1650
+
1651
+ if (stream.match(/^\s*$/, true)) {
1652
+ blankLine(state);
1653
+ return null;
1654
+ }
1655
+
1656
+ state.prevLine = state.thisLine;
1657
+ state.thisLine = { stream: stream };
1658
+
1659
+ // Reset state.taskList
1660
+ state.taskList = false;
1661
+
1662
+ // Reset state.linkText
1663
+ state.linkText = false;
1664
+
1665
+ // Reset state.trailingSpace
1666
+ state.trailingSpace = 0;
1667
+ state.trailingSpaceNewLine = false;
1668
+
1669
+ if (!state.localState) {
1670
+ state.f = state.block;
1671
+ if (state.f != htmlBlock) {
1672
+ var indentation = stream
1673
+ .match(/^\s*/, true)[0]
1674
+ .replace(/\t/g, expandedTab).length;
1675
+ state.indentation = indentation;
1676
+ state.indentationDiff = null;
1677
+ if (indentation > 0) return null;
1678
+ }
1679
+ }
1680
+ }
1681
+ return state.f(stream, state);
1682
+ },
1683
+
1684
+ innerMode: function (state) {
1685
+ if (state.block == htmlBlock)
1686
+ return { state: state.htmlState, mode: htmlMode };
1687
+ if (state.localState)
1688
+ return { state: state.localState, mode: state.localMode };
1689
+ return { state: state, mode: mode };
1690
+ },
1691
+
1692
+ indent: function (state, textAfter, line) {
1693
+ if (state.block == htmlBlock && htmlMode.indent)
1694
+ return htmlMode.indent(state.htmlState, textAfter, line);
1695
+ if (state.localState && state.localMode.indent)
1696
+ return state.localMode.indent(state.localState, textAfter, line);
1697
+ return CodeMirror.Pass;
1698
+ },
1699
+
1700
+ blankLine: blankLine,
1701
+
1702
+ getType: getType,
1703
+
1704
+ blockCommentStart: "<!--",
1705
+ blockCommentEnd: "-->",
1706
+ closeBrackets: "()[]{}''\"\"``",
1707
+ fold: "markdown",
1708
+ };
1709
+ return mode;
1710
+ },
1711
+ "xml",
1712
+ );
1713
+
1714
+ CodeMirror.defineMIME("text/markdown", "markdown");
1715
+
1716
+ CodeMirror.defineMIME("text/x-markdown", "markdown");
1717
+ });