@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.
- package/dist/index.cjs +1806 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +1774 -0
- package/dist/plugins/attachment.d.ts +7 -0
- package/dist/plugins/base-extensions.d.ts +8 -0
- package/dist/plugins/close-brackets.d.ts +8 -0
- package/dist/plugins/expand-text.d.ts +11 -0
- package/dist/plugins/fold.d.ts +8 -0
- package/dist/plugins/hanging-indent.d.ts +7 -0
- package/dist/plugins/indent-guide.d.ts +7 -0
- package/dist/plugins/index.d.ts +22 -0
- package/dist/plugins/keymap.d.ts +8 -0
- package/dist/plugins/line-numbers.d.ts +7 -0
- package/dist/plugins/link-handler.d.ts +8 -0
- package/dist/plugins/list-continuation.d.ts +8 -0
- package/dist/plugins/live-preview.d.ts +8 -0
- package/dist/plugins/markdown-language.d.ts +8 -0
- package/dist/plugins/on-change.d.ts +7 -0
- package/dist/plugins/suggest.d.ts +16 -0
- package/dist/plugins/table-continuation.d.ts +9 -0
- package/dist/plugins/table.d.ts +7 -0
- package/dist/plugins/theme.d.ts +8 -0
- package/dist/plugins/types.d.ts +29 -0
- package/dist/table/copy-widget.d.ts +17 -0
- package/dist/table/detect.d.ts +15 -0
- package/dist/table/format.d.ts +15 -0
- package/dist/table/index.d.ts +6 -0
- package/dist/table/theme.d.ts +8 -0
- package/package.json +57 -0
- package/vendor/app.css +15715 -0
- package/vendor/enhance.js +641 -0
- package/vendor/i18n/en.json +2144 -0
- package/vendor/i18n/zh.json +2144 -0
- package/vendor/lib/codemirror.js +14806 -0
- package/vendor/lib/i18next.min.js +2654 -0
- package/vendor/lib/markdown.js +1717 -0
- package/vendor/lib/mathjax/output/chtml/fonts/tex.js +1 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
- package/vendor/lib/mathjax/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
- package/vendor/lib/mathjax/tex-chtml-full.js +36 -0
- package/vendor/lib/meta.min.js +1 -0
- package/vendor/lib/modes.min.js +236 -0
- package/vendor/lib/turndown.js +679 -0
- package/vendor/mock.js +28 -0
- package/vendor/obsidian-app.patched.js +161786 -0
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
// https://cdn.jsdelivr.net/npm/turndown@7.1.2/dist/turndown.min.js
|
|
2
|
+
var TurndownService = (function () {
|
|
3
|
+
"use strict";
|
|
4
|
+
function e(e, n) {
|
|
5
|
+
return Array(n + 1).join(e);
|
|
6
|
+
}
|
|
7
|
+
var n = [
|
|
8
|
+
"ADDRESS",
|
|
9
|
+
"ARTICLE",
|
|
10
|
+
"ASIDE",
|
|
11
|
+
"AUDIO",
|
|
12
|
+
"BLOCKQUOTE",
|
|
13
|
+
"BODY",
|
|
14
|
+
"CANVAS",
|
|
15
|
+
"CENTER",
|
|
16
|
+
"DD",
|
|
17
|
+
"DIR",
|
|
18
|
+
"DIV",
|
|
19
|
+
"DL",
|
|
20
|
+
"DT",
|
|
21
|
+
"FIELDSET",
|
|
22
|
+
"FIGCAPTION",
|
|
23
|
+
"FIGURE",
|
|
24
|
+
"FOOTER",
|
|
25
|
+
"FORM",
|
|
26
|
+
"FRAMESET",
|
|
27
|
+
"H1",
|
|
28
|
+
"H2",
|
|
29
|
+
"H3",
|
|
30
|
+
"H4",
|
|
31
|
+
"H5",
|
|
32
|
+
"H6",
|
|
33
|
+
"HEADER",
|
|
34
|
+
"HGROUP",
|
|
35
|
+
"HR",
|
|
36
|
+
"HTML",
|
|
37
|
+
"ISINDEX",
|
|
38
|
+
"LI",
|
|
39
|
+
"MAIN",
|
|
40
|
+
"MENU",
|
|
41
|
+
"NAV",
|
|
42
|
+
"NOFRAMES",
|
|
43
|
+
"NOSCRIPT",
|
|
44
|
+
"OL",
|
|
45
|
+
"OUTPUT",
|
|
46
|
+
"P",
|
|
47
|
+
"PRE",
|
|
48
|
+
"SECTION",
|
|
49
|
+
"TABLE",
|
|
50
|
+
"TBODY",
|
|
51
|
+
"TD",
|
|
52
|
+
"TFOOT",
|
|
53
|
+
"TH",
|
|
54
|
+
"THEAD",
|
|
55
|
+
"TR",
|
|
56
|
+
"UL",
|
|
57
|
+
];
|
|
58
|
+
function t(e) {
|
|
59
|
+
return a(e, n);
|
|
60
|
+
}
|
|
61
|
+
var r = [
|
|
62
|
+
"AREA",
|
|
63
|
+
"BASE",
|
|
64
|
+
"BR",
|
|
65
|
+
"COL",
|
|
66
|
+
"COMMAND",
|
|
67
|
+
"EMBED",
|
|
68
|
+
"HR",
|
|
69
|
+
"IMG",
|
|
70
|
+
"INPUT",
|
|
71
|
+
"KEYGEN",
|
|
72
|
+
"LINK",
|
|
73
|
+
"META",
|
|
74
|
+
"PARAM",
|
|
75
|
+
"SOURCE",
|
|
76
|
+
"TRACK",
|
|
77
|
+
"WBR",
|
|
78
|
+
];
|
|
79
|
+
function i(e) {
|
|
80
|
+
return a(e, r);
|
|
81
|
+
}
|
|
82
|
+
var o = [
|
|
83
|
+
"A",
|
|
84
|
+
"TABLE",
|
|
85
|
+
"THEAD",
|
|
86
|
+
"TBODY",
|
|
87
|
+
"TFOOT",
|
|
88
|
+
"TH",
|
|
89
|
+
"TD",
|
|
90
|
+
"IFRAME",
|
|
91
|
+
"SCRIPT",
|
|
92
|
+
"AUDIO",
|
|
93
|
+
"VIDEO",
|
|
94
|
+
];
|
|
95
|
+
function a(e, n) {
|
|
96
|
+
return n.indexOf(e.nodeName) >= 0;
|
|
97
|
+
}
|
|
98
|
+
function l(e, n) {
|
|
99
|
+
return (
|
|
100
|
+
e.getElementsByTagName &&
|
|
101
|
+
n.some(function (n) {
|
|
102
|
+
return e.getElementsByTagName(n).length;
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
var u = {};
|
|
107
|
+
function c(e) {
|
|
108
|
+
return e ? e.replace(/(\n+\s*)+/g, "\n") : "";
|
|
109
|
+
}
|
|
110
|
+
function s(e) {
|
|
111
|
+
for (var n in ((this.options = e),
|
|
112
|
+
(this._keep = []),
|
|
113
|
+
(this._remove = []),
|
|
114
|
+
(this.blankRule = { replacement: e.blankReplacement }),
|
|
115
|
+
(this.keepReplacement = e.keepReplacement),
|
|
116
|
+
(this.defaultRule = { replacement: e.defaultReplacement }),
|
|
117
|
+
(this.array = []),
|
|
118
|
+
e.rules))
|
|
119
|
+
this.array.push(e.rules[n]);
|
|
120
|
+
}
|
|
121
|
+
function f(e, n, t) {
|
|
122
|
+
for (var r = 0; r < e.length; r++) {
|
|
123
|
+
var i = e[r];
|
|
124
|
+
if (d(i, n, t)) return i;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function d(e, n, t) {
|
|
128
|
+
var r = e.filter;
|
|
129
|
+
if ("string" == typeof r) {
|
|
130
|
+
if (r === n.nodeName.toLowerCase()) return !0;
|
|
131
|
+
} else if (Array.isArray(r)) {
|
|
132
|
+
if (r.indexOf(n.nodeName.toLowerCase()) > -1) return !0;
|
|
133
|
+
} else {
|
|
134
|
+
if ("function" != typeof r)
|
|
135
|
+
throw new TypeError(
|
|
136
|
+
"`filter` needs to be a string, array, or function",
|
|
137
|
+
);
|
|
138
|
+
if (r.call(e, n, t)) return !0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function p(e) {
|
|
142
|
+
var n = e.nextSibling || e.parentNode;
|
|
143
|
+
return (e.parentNode.removeChild(e), n);
|
|
144
|
+
}
|
|
145
|
+
function h(e, n, t) {
|
|
146
|
+
return (e && e.parentNode === n) || t(n)
|
|
147
|
+
? n.nextSibling || n.parentNode
|
|
148
|
+
: n.firstChild || n.nextSibling || n.parentNode;
|
|
149
|
+
}
|
|
150
|
+
((u.paragraph = {
|
|
151
|
+
filter: "p",
|
|
152
|
+
replacement: function (e) {
|
|
153
|
+
return "\n\n" + e + "\n\n";
|
|
154
|
+
},
|
|
155
|
+
}),
|
|
156
|
+
(u.lineBreak = {
|
|
157
|
+
filter: "br",
|
|
158
|
+
replacement: function (e, n, t) {
|
|
159
|
+
return t.br + "\n";
|
|
160
|
+
},
|
|
161
|
+
}),
|
|
162
|
+
(u.heading = {
|
|
163
|
+
filter: ["h1", "h2", "h3", "h4", "h5", "h6"],
|
|
164
|
+
replacement: function (n, t, r) {
|
|
165
|
+
var i = Number(t.nodeName.charAt(1));
|
|
166
|
+
return "setext" === r.headingStyle && i < 3
|
|
167
|
+
? "\n\n" + n + "\n" + e(1 === i ? "=" : "-", n.length) + "\n\n"
|
|
168
|
+
: "\n\n" + e("#", i) + " " + n + "\n\n";
|
|
169
|
+
},
|
|
170
|
+
}),
|
|
171
|
+
(u.blockquote = {
|
|
172
|
+
filter: "blockquote",
|
|
173
|
+
replacement: function (e) {
|
|
174
|
+
return (
|
|
175
|
+
"\n\n" +
|
|
176
|
+
(e = (e = e.replace(/^\n+|\n+$/g, "")).replace(/^/gm, "> ")) +
|
|
177
|
+
"\n\n"
|
|
178
|
+
);
|
|
179
|
+
},
|
|
180
|
+
}),
|
|
181
|
+
(u.list = {
|
|
182
|
+
filter: ["ul", "ol"],
|
|
183
|
+
replacement: function (e, n) {
|
|
184
|
+
var t = n.parentNode;
|
|
185
|
+
return "LI" === t.nodeName && t.lastElementChild === n
|
|
186
|
+
? "\n" + e
|
|
187
|
+
: "\n\n" + e + "\n\n";
|
|
188
|
+
},
|
|
189
|
+
}),
|
|
190
|
+
(u.listItem = {
|
|
191
|
+
filter: "li",
|
|
192
|
+
replacement: function (e, n, t) {
|
|
193
|
+
e = e
|
|
194
|
+
.replace(/^\n+/, "")
|
|
195
|
+
.replace(/\n+$/, "\n")
|
|
196
|
+
.replace(/\n/gm, "\n ");
|
|
197
|
+
var r = t.bulletListMarker + " ",
|
|
198
|
+
i = n.parentNode;
|
|
199
|
+
if ("OL" === i.nodeName) {
|
|
200
|
+
var o = i.getAttribute("start"),
|
|
201
|
+
a = Array.prototype.indexOf.call(i.children, n);
|
|
202
|
+
r = (o ? Number(o) + a : a + 1) + ". ";
|
|
203
|
+
}
|
|
204
|
+
return r + e + (n.nextSibling && !/\n$/.test(e) ? "\n" : "");
|
|
205
|
+
},
|
|
206
|
+
}),
|
|
207
|
+
(u.indentedCodeBlock = {
|
|
208
|
+
filter: function (e, n) {
|
|
209
|
+
return (
|
|
210
|
+
"indented" === n.codeBlockStyle &&
|
|
211
|
+
"PRE" === e.nodeName &&
|
|
212
|
+
e.firstChild &&
|
|
213
|
+
"CODE" === e.firstChild.nodeName
|
|
214
|
+
);
|
|
215
|
+
},
|
|
216
|
+
replacement: function (e, n, t) {
|
|
217
|
+
return (
|
|
218
|
+
"\n\n " +
|
|
219
|
+
n.firstChild.textContent.replace(/\n/g, "\n ") +
|
|
220
|
+
"\n\n"
|
|
221
|
+
);
|
|
222
|
+
},
|
|
223
|
+
}),
|
|
224
|
+
(u.fencedCodeBlock = {
|
|
225
|
+
filter: function (e, n) {
|
|
226
|
+
return (
|
|
227
|
+
"fenced" === n.codeBlockStyle &&
|
|
228
|
+
"PRE" === e.nodeName &&
|
|
229
|
+
e.firstChild &&
|
|
230
|
+
"CODE" === e.firstChild.nodeName
|
|
231
|
+
);
|
|
232
|
+
},
|
|
233
|
+
replacement: function (n, t, r) {
|
|
234
|
+
for (
|
|
235
|
+
var i,
|
|
236
|
+
o = ((t.firstChild.getAttribute("class") || "").match(
|
|
237
|
+
/language-(\S+)/,
|
|
238
|
+
) || [null, ""])[1],
|
|
239
|
+
a = t.firstChild.textContent,
|
|
240
|
+
l = r.fence.charAt(0),
|
|
241
|
+
u = 3,
|
|
242
|
+
c = new RegExp("^" + l + "{3,}", "gm");
|
|
243
|
+
(i = c.exec(a));
|
|
244
|
+
)
|
|
245
|
+
i[0].length >= u && (u = i[0].length + 1);
|
|
246
|
+
var s = e(l, u);
|
|
247
|
+
return "\n\n" + s + o + "\n" + a.replace(/\n$/, "") + "\n" + s + "\n\n";
|
|
248
|
+
},
|
|
249
|
+
}),
|
|
250
|
+
(u.horizontalRule = {
|
|
251
|
+
filter: "hr",
|
|
252
|
+
replacement: function (e, n, t) {
|
|
253
|
+
return "\n\n" + t.hr + "\n\n";
|
|
254
|
+
},
|
|
255
|
+
}),
|
|
256
|
+
(u.inlineLink = {
|
|
257
|
+
filter: function (e, n) {
|
|
258
|
+
return (
|
|
259
|
+
"inlined" === n.linkStyle &&
|
|
260
|
+
"A" === e.nodeName &&
|
|
261
|
+
e.getAttribute("href")
|
|
262
|
+
);
|
|
263
|
+
},
|
|
264
|
+
replacement: function (e, n) {
|
|
265
|
+
var t = n.getAttribute("href"),
|
|
266
|
+
r = c(n.getAttribute("title"));
|
|
267
|
+
return (r && (r = ' "' + r + '"'), "[" + e + "](" + t + r + ")");
|
|
268
|
+
},
|
|
269
|
+
}),
|
|
270
|
+
(u.referenceLink = {
|
|
271
|
+
filter: function (e, n) {
|
|
272
|
+
return (
|
|
273
|
+
"referenced" === n.linkStyle &&
|
|
274
|
+
"A" === e.nodeName &&
|
|
275
|
+
e.getAttribute("href")
|
|
276
|
+
);
|
|
277
|
+
},
|
|
278
|
+
replacement: function (e, n, t) {
|
|
279
|
+
var r,
|
|
280
|
+
i,
|
|
281
|
+
o = n.getAttribute("href"),
|
|
282
|
+
a = c(n.getAttribute("title"));
|
|
283
|
+
switch ((a && (a = ' "' + a + '"'), t.linkReferenceStyle)) {
|
|
284
|
+
case "collapsed":
|
|
285
|
+
((r = "[" + e + "][]"), (i = "[" + e + "]: " + o + a));
|
|
286
|
+
break;
|
|
287
|
+
case "shortcut":
|
|
288
|
+
((r = "[" + e + "]"), (i = "[" + e + "]: " + o + a));
|
|
289
|
+
break;
|
|
290
|
+
default:
|
|
291
|
+
var l = this.references.length + 1;
|
|
292
|
+
((r = "[" + e + "][" + l + "]"), (i = "[" + l + "]: " + o + a));
|
|
293
|
+
}
|
|
294
|
+
return (this.references.push(i), r);
|
|
295
|
+
},
|
|
296
|
+
references: [],
|
|
297
|
+
append: function (e) {
|
|
298
|
+
var n = "";
|
|
299
|
+
return (
|
|
300
|
+
this.references.length &&
|
|
301
|
+
((n = "\n\n" + this.references.join("\n") + "\n\n"),
|
|
302
|
+
(this.references = [])),
|
|
303
|
+
n
|
|
304
|
+
);
|
|
305
|
+
},
|
|
306
|
+
}),
|
|
307
|
+
(u.emphasis = {
|
|
308
|
+
filter: ["em", "i"],
|
|
309
|
+
replacement: function (e, n, t) {
|
|
310
|
+
return e.trim() ? t.emDelimiter + e + t.emDelimiter : "";
|
|
311
|
+
},
|
|
312
|
+
}),
|
|
313
|
+
(u.strong = {
|
|
314
|
+
filter: ["strong", "b"],
|
|
315
|
+
replacement: function (e, n, t) {
|
|
316
|
+
return e.trim() ? t.strongDelimiter + e + t.strongDelimiter : "";
|
|
317
|
+
},
|
|
318
|
+
}),
|
|
319
|
+
(u.code = {
|
|
320
|
+
filter: function (e) {
|
|
321
|
+
var n = e.previousSibling || e.nextSibling,
|
|
322
|
+
t = "PRE" === e.parentNode.nodeName && !n;
|
|
323
|
+
return "CODE" === e.nodeName && !t;
|
|
324
|
+
},
|
|
325
|
+
replacement: function (e) {
|
|
326
|
+
if (!e) return "";
|
|
327
|
+
e = e.replace(/\r?\n|\r/g, " ");
|
|
328
|
+
for (
|
|
329
|
+
var n = /^`|^ .*?[^ ].* $|`$/.test(e) ? " " : "",
|
|
330
|
+
t = "`",
|
|
331
|
+
r = e.match(/`+/gm) || [];
|
|
332
|
+
-1 !== r.indexOf(t);
|
|
333
|
+
)
|
|
334
|
+
t += "`";
|
|
335
|
+
return t + n + e + n + t;
|
|
336
|
+
},
|
|
337
|
+
}),
|
|
338
|
+
(u.image = {
|
|
339
|
+
filter: "img",
|
|
340
|
+
replacement: function (e, n) {
|
|
341
|
+
var t = c(n.getAttribute("alt")),
|
|
342
|
+
r = n.getAttribute("src") || "",
|
|
343
|
+
i = c(n.getAttribute("title"));
|
|
344
|
+
return r ? " + ")" : "";
|
|
345
|
+
},
|
|
346
|
+
}),
|
|
347
|
+
(s.prototype = {
|
|
348
|
+
add: function (e, n) {
|
|
349
|
+
this.array.unshift(n);
|
|
350
|
+
},
|
|
351
|
+
keep: function (e) {
|
|
352
|
+
this._keep.unshift({ filter: e, replacement: this.keepReplacement });
|
|
353
|
+
},
|
|
354
|
+
remove: function (e) {
|
|
355
|
+
this._remove.unshift({
|
|
356
|
+
filter: e,
|
|
357
|
+
replacement: function () {
|
|
358
|
+
return "";
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
},
|
|
362
|
+
forNode: function (e) {
|
|
363
|
+
return e.isBlank
|
|
364
|
+
? this.blankRule
|
|
365
|
+
: (n = f(this.array, e, this.options)) ||
|
|
366
|
+
(n = f(this._keep, e, this.options)) ||
|
|
367
|
+
(n = f(this._remove, e, this.options))
|
|
368
|
+
? n
|
|
369
|
+
: this.defaultRule;
|
|
370
|
+
var n;
|
|
371
|
+
},
|
|
372
|
+
forEach: function (e) {
|
|
373
|
+
for (var n = 0; n < this.array.length; n++) e(this.array[n], n);
|
|
374
|
+
},
|
|
375
|
+
}));
|
|
376
|
+
var g = "undefined" != typeof window ? window : {};
|
|
377
|
+
var m,
|
|
378
|
+
v,
|
|
379
|
+
A = (function () {
|
|
380
|
+
var e = g.DOMParser,
|
|
381
|
+
n = !1;
|
|
382
|
+
try {
|
|
383
|
+
new e().parseFromString("", "text/html") && (n = !0);
|
|
384
|
+
} catch (e) {}
|
|
385
|
+
return n;
|
|
386
|
+
})()
|
|
387
|
+
? g.DOMParser
|
|
388
|
+
: ((m = function () {}),
|
|
389
|
+
(function () {
|
|
390
|
+
var e = !1;
|
|
391
|
+
try {
|
|
392
|
+
document.implementation.createHTMLDocument("").open();
|
|
393
|
+
} catch (n) {
|
|
394
|
+
window.ActiveXObject && (e = !0);
|
|
395
|
+
}
|
|
396
|
+
return e;
|
|
397
|
+
})()
|
|
398
|
+
? (m.prototype.parseFromString = function (e) {
|
|
399
|
+
var n = new window.ActiveXObject("htmlfile");
|
|
400
|
+
return (
|
|
401
|
+
(n.designMode = "on"),
|
|
402
|
+
n.open(),
|
|
403
|
+
n.write(e),
|
|
404
|
+
n.close(),
|
|
405
|
+
n
|
|
406
|
+
);
|
|
407
|
+
})
|
|
408
|
+
: (m.prototype.parseFromString = function (e) {
|
|
409
|
+
var n = document.implementation.createHTMLDocument("");
|
|
410
|
+
return (n.open(), n.write(e), n.close(), n);
|
|
411
|
+
}),
|
|
412
|
+
m);
|
|
413
|
+
function y(e, n) {
|
|
414
|
+
var r;
|
|
415
|
+
"string" == typeof e
|
|
416
|
+
? (r = (v = v || new A())
|
|
417
|
+
.parseFromString(
|
|
418
|
+
'<x-turndown id="turndown-root">' + e + "</x-turndown>",
|
|
419
|
+
"text/html",
|
|
420
|
+
)
|
|
421
|
+
.getElementById("turndown-root"))
|
|
422
|
+
: (r = e.cloneNode(!0));
|
|
423
|
+
return (
|
|
424
|
+
(function (e) {
|
|
425
|
+
var n = e.element,
|
|
426
|
+
t = e.isBlock,
|
|
427
|
+
r = e.isVoid,
|
|
428
|
+
i =
|
|
429
|
+
e.isPre ||
|
|
430
|
+
function (e) {
|
|
431
|
+
return "PRE" === e.nodeName;
|
|
432
|
+
};
|
|
433
|
+
if (n.firstChild && !i(n)) {
|
|
434
|
+
for (var o = null, a = !1, l = null, u = h(l, n, i); u !== n; ) {
|
|
435
|
+
if (3 === u.nodeType || 4 === u.nodeType) {
|
|
436
|
+
var c = u.data.replace(/[ \r\n\t]+/g, " ");
|
|
437
|
+
if (
|
|
438
|
+
((o && !/ $/.test(o.data)) ||
|
|
439
|
+
a ||
|
|
440
|
+
" " !== c[0] ||
|
|
441
|
+
(c = c.substr(1)),
|
|
442
|
+
!c)
|
|
443
|
+
) {
|
|
444
|
+
u = p(u);
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
((u.data = c), (o = u));
|
|
448
|
+
} else {
|
|
449
|
+
if (1 !== u.nodeType) {
|
|
450
|
+
u = p(u);
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
t(u) || "BR" === u.nodeName
|
|
454
|
+
? (o && (o.data = o.data.replace(/ $/, "")),
|
|
455
|
+
(o = null),
|
|
456
|
+
(a = !1))
|
|
457
|
+
: r(u) || i(u)
|
|
458
|
+
? ((o = null), (a = !0))
|
|
459
|
+
: o && (a = !1);
|
|
460
|
+
}
|
|
461
|
+
var s = h(l, u, i);
|
|
462
|
+
((l = u), (u = s));
|
|
463
|
+
}
|
|
464
|
+
o && ((o.data = o.data.replace(/ $/, "")), o.data || p(o));
|
|
465
|
+
}
|
|
466
|
+
})({
|
|
467
|
+
element: r,
|
|
468
|
+
isBlock: t,
|
|
469
|
+
isVoid: i,
|
|
470
|
+
isPre: n.preformattedCode ? N : null,
|
|
471
|
+
}),
|
|
472
|
+
r
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
function N(e) {
|
|
476
|
+
return "PRE" === e.nodeName || "CODE" === e.nodeName;
|
|
477
|
+
}
|
|
478
|
+
function E(e, n) {
|
|
479
|
+
return (
|
|
480
|
+
(e.isBlock = t(e)),
|
|
481
|
+
(e.isCode = "CODE" === e.nodeName || e.parentNode.isCode),
|
|
482
|
+
(e.isBlank = (function (e) {
|
|
483
|
+
return (
|
|
484
|
+
!i(e) &&
|
|
485
|
+
!(function (e) {
|
|
486
|
+
return a(e, o);
|
|
487
|
+
})(e) &&
|
|
488
|
+
/^\s*$/i.test(e.textContent) &&
|
|
489
|
+
!(function (e) {
|
|
490
|
+
return l(e, r);
|
|
491
|
+
})(e) &&
|
|
492
|
+
!(function (e) {
|
|
493
|
+
return l(e, o);
|
|
494
|
+
})(e)
|
|
495
|
+
);
|
|
496
|
+
})(e)),
|
|
497
|
+
(e.flankingWhitespace = (function (e, n) {
|
|
498
|
+
if (e.isBlock || (n.preformattedCode && e.isCode))
|
|
499
|
+
return { leading: "", trailing: "" };
|
|
500
|
+
var t =
|
|
501
|
+
((r = e.textContent),
|
|
502
|
+
(i = r.match(
|
|
503
|
+
/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/,
|
|
504
|
+
)),
|
|
505
|
+
{
|
|
506
|
+
leading: i[1],
|
|
507
|
+
leadingAscii: i[2],
|
|
508
|
+
leadingNonAscii: i[3],
|
|
509
|
+
trailing: i[4],
|
|
510
|
+
trailingNonAscii: i[5],
|
|
511
|
+
trailingAscii: i[6],
|
|
512
|
+
});
|
|
513
|
+
var r, i;
|
|
514
|
+
t.leadingAscii && T("left", e, n) && (t.leading = t.leadingNonAscii);
|
|
515
|
+
t.trailingAscii &&
|
|
516
|
+
T("right", e, n) &&
|
|
517
|
+
(t.trailing = t.trailingNonAscii);
|
|
518
|
+
return { leading: t.leading, trailing: t.trailing };
|
|
519
|
+
})(e, n)),
|
|
520
|
+
e
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
function T(e, n, r) {
|
|
524
|
+
var i, o, a;
|
|
525
|
+
return (
|
|
526
|
+
"left" === e
|
|
527
|
+
? ((i = n.previousSibling), (o = / $/))
|
|
528
|
+
: ((i = n.nextSibling), (o = /^ /)),
|
|
529
|
+
i &&
|
|
530
|
+
(3 === i.nodeType
|
|
531
|
+
? (a = o.test(i.nodeValue))
|
|
532
|
+
: r.preformattedCode && "CODE" === i.nodeName
|
|
533
|
+
? (a = !1)
|
|
534
|
+
: 1 !== i.nodeType || t(i) || (a = o.test(i.textContent))),
|
|
535
|
+
a
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
var R = Array.prototype.reduce,
|
|
539
|
+
C = [
|
|
540
|
+
[/\\/g, "\\\\"],
|
|
541
|
+
[/\*/g, "\\*"],
|
|
542
|
+
[/^-/g, "\\-"],
|
|
543
|
+
[/^\+ /g, "\\+ "],
|
|
544
|
+
[/^(=+)/g, "\\$1"],
|
|
545
|
+
[/^(#{1,6}) /g, "\\$1 "],
|
|
546
|
+
[/`/g, "\\`"],
|
|
547
|
+
[/^~~~/g, "\\~~~"],
|
|
548
|
+
[/\[/g, "\\["],
|
|
549
|
+
[/\]/g, "\\]"],
|
|
550
|
+
[/^>/g, "\\>"],
|
|
551
|
+
[/_/g, "\\_"],
|
|
552
|
+
[/^(\d+)\. /g, "$1\\. "],
|
|
553
|
+
];
|
|
554
|
+
function k(e) {
|
|
555
|
+
if (!(this instanceof k)) return new k(e);
|
|
556
|
+
var n = {
|
|
557
|
+
rules: u,
|
|
558
|
+
headingStyle: "setext",
|
|
559
|
+
hr: "* * *",
|
|
560
|
+
bulletListMarker: "*",
|
|
561
|
+
codeBlockStyle: "indented",
|
|
562
|
+
fence: "```",
|
|
563
|
+
emDelimiter: "_",
|
|
564
|
+
strongDelimiter: "**",
|
|
565
|
+
linkStyle: "inlined",
|
|
566
|
+
linkReferenceStyle: "full",
|
|
567
|
+
br: " ",
|
|
568
|
+
preformattedCode: !1,
|
|
569
|
+
blankReplacement: function (e, n) {
|
|
570
|
+
return n.isBlock ? "\n\n" : "";
|
|
571
|
+
},
|
|
572
|
+
keepReplacement: function (e, n) {
|
|
573
|
+
return n.isBlock ? "\n\n" + n.outerHTML + "\n\n" : n.outerHTML;
|
|
574
|
+
},
|
|
575
|
+
defaultReplacement: function (e, n) {
|
|
576
|
+
return n.isBlock ? "\n\n" + e + "\n\n" : e;
|
|
577
|
+
},
|
|
578
|
+
};
|
|
579
|
+
((this.options = (function (e) {
|
|
580
|
+
for (var n = 1; n < arguments.length; n++) {
|
|
581
|
+
var t = arguments[n];
|
|
582
|
+
for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]);
|
|
583
|
+
}
|
|
584
|
+
return e;
|
|
585
|
+
})({}, n, e)),
|
|
586
|
+
(this.rules = new s(this.options)));
|
|
587
|
+
}
|
|
588
|
+
function b(e) {
|
|
589
|
+
var n = this;
|
|
590
|
+
return R.call(
|
|
591
|
+
e.childNodes,
|
|
592
|
+
function (e, t) {
|
|
593
|
+
var r = "";
|
|
594
|
+
return (
|
|
595
|
+
3 === (t = new E(t, n.options)).nodeType
|
|
596
|
+
? (r = t.isCode ? t.nodeValue : n.escape(t.nodeValue))
|
|
597
|
+
: 1 === t.nodeType && (r = D.call(n, t)),
|
|
598
|
+
S(e, r)
|
|
599
|
+
);
|
|
600
|
+
},
|
|
601
|
+
"",
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
function O(e) {
|
|
605
|
+
var n = this;
|
|
606
|
+
return (
|
|
607
|
+
this.rules.forEach(function (t) {
|
|
608
|
+
"function" == typeof t.append && (e = S(e, t.append(n.options)));
|
|
609
|
+
}),
|
|
610
|
+
e.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "")
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
function D(e) {
|
|
614
|
+
var n = this.rules.forNode(e),
|
|
615
|
+
t = b.call(this, e),
|
|
616
|
+
r = e.flankingWhitespace;
|
|
617
|
+
return (
|
|
618
|
+
(r.leading || r.trailing) && (t = t.trim()),
|
|
619
|
+
r.leading + n.replacement(t, e, this.options) + r.trailing
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
function S(e, n) {
|
|
623
|
+
var t = (function (e) {
|
|
624
|
+
for (var n = e.length; n > 0 && "\n" === e[n - 1]; ) n--;
|
|
625
|
+
return e.substring(0, n);
|
|
626
|
+
})(e),
|
|
627
|
+
r = n.replace(/^\n*/, ""),
|
|
628
|
+
i = Math.max(e.length - t.length, n.length - r.length);
|
|
629
|
+
return t + "\n\n".substring(0, i) + r;
|
|
630
|
+
}
|
|
631
|
+
return (
|
|
632
|
+
(k.prototype = {
|
|
633
|
+
turndown: function (e) {
|
|
634
|
+
if (
|
|
635
|
+
!(function (e) {
|
|
636
|
+
return (
|
|
637
|
+
null != e &&
|
|
638
|
+
("string" == typeof e ||
|
|
639
|
+
(e.nodeType &&
|
|
640
|
+
(1 === e.nodeType || 9 === e.nodeType || 11 === e.nodeType)))
|
|
641
|
+
);
|
|
642
|
+
})(e)
|
|
643
|
+
)
|
|
644
|
+
throw new TypeError(
|
|
645
|
+
e + " is not a string, or an element/document/fragment node.",
|
|
646
|
+
);
|
|
647
|
+
if ("" === e) return "";
|
|
648
|
+
var n = b.call(this, new y(e, this.options));
|
|
649
|
+
return O.call(this, n);
|
|
650
|
+
},
|
|
651
|
+
use: function (e) {
|
|
652
|
+
if (Array.isArray(e)) for (var n = 0; n < e.length; n++) this.use(e[n]);
|
|
653
|
+
else {
|
|
654
|
+
if ("function" != typeof e)
|
|
655
|
+
throw new TypeError(
|
|
656
|
+
"plugin must be a Function or an Array of Functions",
|
|
657
|
+
);
|
|
658
|
+
e(this);
|
|
659
|
+
}
|
|
660
|
+
return this;
|
|
661
|
+
},
|
|
662
|
+
addRule: function (e, n) {
|
|
663
|
+
return (this.rules.add(e, n), this);
|
|
664
|
+
},
|
|
665
|
+
keep: function (e) {
|
|
666
|
+
return (this.rules.keep(e), this);
|
|
667
|
+
},
|
|
668
|
+
remove: function (e) {
|
|
669
|
+
return (this.rules.remove(e), this);
|
|
670
|
+
},
|
|
671
|
+
escape: function (e) {
|
|
672
|
+
return C.reduce(function (e, n) {
|
|
673
|
+
return e.replace(n[0], n[1]);
|
|
674
|
+
}, e);
|
|
675
|
+
},
|
|
676
|
+
}),
|
|
677
|
+
k
|
|
678
|
+
);
|
|
679
|
+
})();
|
package/vendor/mock.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
console.log('[vendor] mock.js starting...');
|
|
2
|
+
window.addEventListener('error', function(e) { console.error('[vendor] GLOBAL ERROR:', e.message, 'at', e.filename, ':', e.lineno); });
|
|
3
|
+
// Browser global mocks required by Obsidian's app.js
|
|
4
|
+
console.log('[vendor] mock.js executing...');
|
|
5
|
+
// Load i18n translations
|
|
6
|
+
window.OBSIDIAN_DEFAULT_I18N = {};
|
|
7
|
+
i18next.init({ fallbackLng: 'en', ns: ['app'], defaultNS: 'app', initImmediate: false, interpolation: { escapeValue: false } });
|
|
8
|
+
|
|
9
|
+
// Load translation bundle asynchronously
|
|
10
|
+
fetch('/i18n/en.json')
|
|
11
|
+
.then(r => r.json())
|
|
12
|
+
.then(data => {
|
|
13
|
+
window.OBSIDIAN_DEFAULT_I18N = data;
|
|
14
|
+
i18next.addResourceBundle('en', 'app', data);
|
|
15
|
+
})
|
|
16
|
+
.catch(() => {
|
|
17
|
+
i18next.addResourceBundle('en', 'app', {});
|
|
18
|
+
});
|
|
19
|
+
window.DOMPurify = { sanitize(h) { return h; }, addHook(){}, removeHook(){}, setConfig(){}, isSupported: true };
|
|
20
|
+
window.activeWindow = window;
|
|
21
|
+
window.activeDocument = document;
|
|
22
|
+
window.initVimMode = () => ({ Vim: {} });
|
|
23
|
+
window.CodeMirrorAdapter = {};
|
|
24
|
+
window.process = { platform: 'win32', env: {}, versions: { electron: '28.0.0' }, cwd() { return '/'; } };
|
|
25
|
+
window.ready = function() {};
|
|
26
|
+
|
|
27
|
+
if (!Event.prototype.detach) Event.prototype.detach = function() {};
|
|
28
|
+
console.log('[vendor] mock.js done, __cm6:', typeof window.__cm6);
|