markmap-lib 0.17.2-alpha.0 → 0.17.3-alpha.1
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/browser/index.iife.js +677 -807
- package/dist/browser/index.mjs +180 -37
- package/dist/index.js +3 -8
- package/dist/index.mjs +3 -8
- package/dist/index.no-plugins.js +3 -5
- package/dist/index.no-plugins.mjs +3 -5
- package/dist/plugins.js +22 -33
- package/dist/plugins.mjs +22 -33
- package/package.json +5 -5
package/dist/browser/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import md_mark from "markdown-it-mark";
|
|
|
6
6
|
import md_sub from "markdown-it-sub";
|
|
7
7
|
import md_sup from "markdown-it-sup";
|
|
8
8
|
import { parse } from "yaml";
|
|
9
|
-
import
|
|
9
|
+
import require$$0 from "katex";
|
|
10
10
|
function initializeMarkdownIt() {
|
|
11
11
|
const md = MarkdownIt({
|
|
12
12
|
html: true,
|
|
@@ -58,7 +58,6 @@ const plugin$3 = definePlugin({
|
|
|
58
58
|
return {};
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
-
const pluginCheckbox = plugin$3;
|
|
62
61
|
const name$4 = "frontmatter";
|
|
63
62
|
const pluginFrontmatter = definePlugin({
|
|
64
63
|
name: name$4,
|
|
@@ -66,11 +65,9 @@ const pluginFrontmatter = definePlugin({
|
|
|
66
65
|
transformHooks.beforeParse.tap((_md, context) => {
|
|
67
66
|
var _a;
|
|
68
67
|
const { content } = context;
|
|
69
|
-
if (!/^---\r?\n/.test(content))
|
|
70
|
-
return;
|
|
68
|
+
if (!/^---\r?\n/.test(content)) return;
|
|
71
69
|
const match = /\n---\r?\n/.exec(content);
|
|
72
|
-
if (!match)
|
|
73
|
-
return;
|
|
70
|
+
if (!match) return;
|
|
74
71
|
const raw = content.slice(4, match.index).trimEnd();
|
|
75
72
|
let frontmatter;
|
|
76
73
|
try {
|
|
@@ -95,29 +92,24 @@ const pluginFrontmatter = definePlugin({
|
|
|
95
92
|
}
|
|
96
93
|
});
|
|
97
94
|
function normalizeMarkmapJsonOptions(options) {
|
|
98
|
-
if (!options)
|
|
99
|
-
return;
|
|
95
|
+
if (!options) return;
|
|
100
96
|
["color", "extraJs", "extraCss"].forEach((key) => {
|
|
101
|
-
if (options[key] != null)
|
|
102
|
-
options[key] = normalizeStringArray(options[key]);
|
|
97
|
+
if (options[key] != null) options[key] = normalizeStringArray(options[key]);
|
|
103
98
|
});
|
|
104
99
|
["duration", "maxWidth", "initialExpandLevel"].forEach((key) => {
|
|
105
|
-
if (options[key] != null)
|
|
106
|
-
options[key] = normalizeNumber(options[key]);
|
|
100
|
+
if (options[key] != null) options[key] = normalizeNumber(options[key]);
|
|
107
101
|
});
|
|
108
102
|
return options;
|
|
109
103
|
}
|
|
110
104
|
function normalizeStringArray(value) {
|
|
111
105
|
let result;
|
|
112
|
-
if (typeof value === "string")
|
|
113
|
-
result = [value];
|
|
106
|
+
if (typeof value === "string") result = [value];
|
|
114
107
|
else if (Array.isArray(value))
|
|
115
108
|
result = value.filter((item) => item && typeof item === "string");
|
|
116
109
|
return (result == null ? void 0 : result.length) ? result : void 0;
|
|
117
110
|
}
|
|
118
111
|
function normalizeNumber(value) {
|
|
119
|
-
if (isNaN(+value))
|
|
120
|
-
return;
|
|
112
|
+
if (isNaN(+value)) return;
|
|
121
113
|
return +value;
|
|
122
114
|
}
|
|
123
115
|
function patchJSItem(urlBuilder, item) {
|
|
@@ -146,14 +138,14 @@ function patchCSSItem(urlBuilder, item) {
|
|
|
146
138
|
}
|
|
147
139
|
const name$3 = "hljs";
|
|
148
140
|
const preloadScripts$1 = [
|
|
149
|
-
`@highlightjs/cdn-assets@${"11.
|
|
141
|
+
`@highlightjs/cdn-assets@${"11.10.0"}/highlight.min.js`
|
|
150
142
|
].map((path) => buildJSItem(path));
|
|
151
143
|
const styles$1 = [
|
|
152
|
-
`@highlightjs/cdn-assets@${"11.
|
|
144
|
+
`@highlightjs/cdn-assets@${"11.10.0"}/styles/default.min.css`
|
|
153
145
|
].map((path) => buildCSSItem(path));
|
|
154
146
|
const config$1 = {
|
|
155
147
|
versions: {
|
|
156
|
-
hljs: "11.
|
|
148
|
+
hljs: "11.10.0"
|
|
157
149
|
},
|
|
158
150
|
preloadScripts: preloadScripts$1,
|
|
159
151
|
styles: styles$1
|
|
@@ -197,7 +189,162 @@ const plugin$2 = definePlugin({
|
|
|
197
189
|
};
|
|
198
190
|
}
|
|
199
191
|
});
|
|
200
|
-
|
|
192
|
+
function getDefaultExportFromCjs(x) {
|
|
193
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
194
|
+
}
|
|
195
|
+
var katex = require$$0;
|
|
196
|
+
function isValidDelim(state, pos) {
|
|
197
|
+
var prevChar, nextChar, max = state.posMax, can_open = true, can_close = true;
|
|
198
|
+
prevChar = pos > 0 ? state.src.charCodeAt(pos - 1) : -1;
|
|
199
|
+
nextChar = pos + 1 <= max ? state.src.charCodeAt(pos + 1) : -1;
|
|
200
|
+
if (prevChar === 32 || prevChar === 9 || nextChar >= 48 && nextChar <= 57) {
|
|
201
|
+
can_close = false;
|
|
202
|
+
}
|
|
203
|
+
if (nextChar === 32 || nextChar === 9) {
|
|
204
|
+
can_open = false;
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
can_open,
|
|
208
|
+
can_close
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function math_inline(state, silent) {
|
|
212
|
+
var start, match, token, res, pos;
|
|
213
|
+
if (state.src[state.pos] !== "$") {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
res = isValidDelim(state, state.pos);
|
|
217
|
+
if (!res.can_open) {
|
|
218
|
+
if (!silent) {
|
|
219
|
+
state.pending += "$";
|
|
220
|
+
}
|
|
221
|
+
state.pos += 1;
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
start = state.pos + 1;
|
|
225
|
+
match = start;
|
|
226
|
+
while ((match = state.src.indexOf("$", match)) !== -1) {
|
|
227
|
+
pos = match - 1;
|
|
228
|
+
while (state.src[pos] === "\\") {
|
|
229
|
+
pos -= 1;
|
|
230
|
+
}
|
|
231
|
+
if ((match - pos) % 2 == 1) {
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
match += 1;
|
|
235
|
+
}
|
|
236
|
+
if (match === -1) {
|
|
237
|
+
if (!silent) {
|
|
238
|
+
state.pending += "$";
|
|
239
|
+
}
|
|
240
|
+
state.pos = start;
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
if (match - start === 0) {
|
|
244
|
+
if (!silent) {
|
|
245
|
+
state.pending += "$$";
|
|
246
|
+
}
|
|
247
|
+
state.pos = start + 1;
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
res = isValidDelim(state, match);
|
|
251
|
+
if (!res.can_close) {
|
|
252
|
+
if (!silent) {
|
|
253
|
+
state.pending += "$";
|
|
254
|
+
}
|
|
255
|
+
state.pos = start;
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
if (!silent) {
|
|
259
|
+
token = state.push("math_inline", "math", 0);
|
|
260
|
+
token.markup = "$";
|
|
261
|
+
token.content = state.src.slice(start, match);
|
|
262
|
+
}
|
|
263
|
+
state.pos = match + 1;
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
function math_block(state, start, end, silent) {
|
|
267
|
+
var firstLine, lastLine, next, lastPos, found = false, token, pos = state.bMarks[start] + state.tShift[start], max = state.eMarks[start];
|
|
268
|
+
if (pos + 2 > max) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
if (state.src.slice(pos, pos + 2) !== "$$") {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
pos += 2;
|
|
275
|
+
firstLine = state.src.slice(pos, max);
|
|
276
|
+
if (silent) {
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
if (firstLine.trim().slice(-2) === "$$") {
|
|
280
|
+
firstLine = firstLine.trim().slice(0, -2);
|
|
281
|
+
found = true;
|
|
282
|
+
}
|
|
283
|
+
for (next = start; !found; ) {
|
|
284
|
+
next++;
|
|
285
|
+
if (next >= end) {
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
pos = state.bMarks[next] + state.tShift[next];
|
|
289
|
+
max = state.eMarks[next];
|
|
290
|
+
if (pos < max && state.tShift[next] < state.blkIndent) {
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
if (state.src.slice(pos, max).trim().slice(-2) === "$$") {
|
|
294
|
+
lastPos = state.src.slice(0, max).lastIndexOf("$$");
|
|
295
|
+
lastLine = state.src.slice(pos, lastPos);
|
|
296
|
+
found = true;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
state.line = next + 1;
|
|
300
|
+
token = state.push("math_block", "math", 0);
|
|
301
|
+
token.block = true;
|
|
302
|
+
token.content = (firstLine && firstLine.trim() ? firstLine + "\n" : "") + state.getLines(start + 1, next, state.tShift[start], true) + (lastLine && lastLine.trim() ? lastLine : "");
|
|
303
|
+
token.map = [start, state.line];
|
|
304
|
+
token.markup = "$$";
|
|
305
|
+
return true;
|
|
306
|
+
}
|
|
307
|
+
function escapeHtml(unsafe) {
|
|
308
|
+
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
309
|
+
}
|
|
310
|
+
var markdownItKatex = function math_plugin(md, options) {
|
|
311
|
+
options = options || {};
|
|
312
|
+
var katexInline = function(latex) {
|
|
313
|
+
options.displayMode = false;
|
|
314
|
+
try {
|
|
315
|
+
return katex.renderToString(latex, options);
|
|
316
|
+
} catch (error) {
|
|
317
|
+
if (options.throwOnError) {
|
|
318
|
+
console.log(error);
|
|
319
|
+
}
|
|
320
|
+
return `<span class='katex-error' title='${escapeHtml(error.toString())}'>${escapeHtml(latex)}</span>`;
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
var inlineRenderer = function(tokens, idx) {
|
|
324
|
+
return katexInline(tokens[idx].content);
|
|
325
|
+
};
|
|
326
|
+
var katexBlock = function(latex) {
|
|
327
|
+
options.displayMode = true;
|
|
328
|
+
try {
|
|
329
|
+
return "<p class='katex-block'>" + katex.renderToString(latex, options) + "</p>";
|
|
330
|
+
} catch (error) {
|
|
331
|
+
if (options.throwOnError) {
|
|
332
|
+
console.log(error);
|
|
333
|
+
}
|
|
334
|
+
return `<p class='katex-block katex-error' title='${escapeHtml(error.toString())}'>${escapeHtml(latex)}</p>`;
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
var blockRenderer = function(tokens, idx) {
|
|
338
|
+
return katexBlock(tokens[idx].content) + "\n";
|
|
339
|
+
};
|
|
340
|
+
md.inline.ruler.after("escape", "math_inline", math_inline);
|
|
341
|
+
md.block.ruler.after("blockquote", "math_block", math_block, {
|
|
342
|
+
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
343
|
+
});
|
|
344
|
+
md.renderer.rules.math_inline = inlineRenderer;
|
|
345
|
+
md.renderer.rules.math_block = blockRenderer;
|
|
346
|
+
};
|
|
347
|
+
const katexPlugin = /* @__PURE__ */ getDefaultExportFromCjs(markdownItKatex);
|
|
201
348
|
function addDefaultVersions(paths, name2, version) {
|
|
202
349
|
return paths.map((path) => {
|
|
203
350
|
if (typeof path === "string" && !path.includes("://")) {
|
|
@@ -216,18 +363,18 @@ function addDefaultVersions(paths, name2, version) {
|
|
|
216
363
|
}
|
|
217
364
|
const name$2 = "katex";
|
|
218
365
|
const preloadScripts = [
|
|
219
|
-
`katex@${"0.16.
|
|
366
|
+
`katex@${"0.16.11"}/dist/katex.min.js`
|
|
220
367
|
].map((path) => buildJSItem(path));
|
|
221
368
|
const webfontloader = buildJSItem(
|
|
222
369
|
`webfontloader@${"1.6.28"}/webfontloader.js`
|
|
223
370
|
);
|
|
224
371
|
webfontloader.data.defer = true;
|
|
225
|
-
const styles = [`katex@${"0.16.
|
|
372
|
+
const styles = [`katex@${"0.16.11"}/dist/katex.min.css`].map(
|
|
226
373
|
(path) => buildCSSItem(path)
|
|
227
374
|
);
|
|
228
375
|
const config = {
|
|
229
376
|
versions: {
|
|
230
|
-
katex: "0.16.
|
|
377
|
+
katex: "0.16.11",
|
|
231
378
|
webfontloader: "1.6.28"
|
|
232
379
|
},
|
|
233
380
|
preloadScripts,
|
|
@@ -281,9 +428,9 @@ const plugin$1 = definePlugin({
|
|
|
281
428
|
return loading;
|
|
282
429
|
};
|
|
283
430
|
const renderKatex = (source, displayMode) => {
|
|
284
|
-
const { katex } = window;
|
|
285
|
-
if (
|
|
286
|
-
return
|
|
431
|
+
const { katex: katex2 } = window;
|
|
432
|
+
if (katex2) {
|
|
433
|
+
return katex2.renderToString(source, {
|
|
287
434
|
displayMode,
|
|
288
435
|
throwOnError: false
|
|
289
436
|
});
|
|
@@ -333,7 +480,6 @@ const plugin$1 = definePlugin({
|
|
|
333
480
|
};
|
|
334
481
|
}
|
|
335
482
|
});
|
|
336
|
-
const pluginKatex = plugin$1;
|
|
337
483
|
const name$1 = "npmUrl";
|
|
338
484
|
const pluginNpmUrl = definePlugin({
|
|
339
485
|
name: name$1,
|
|
@@ -379,14 +525,13 @@ const plugin = definePlugin({
|
|
|
379
525
|
return {};
|
|
380
526
|
}
|
|
381
527
|
});
|
|
382
|
-
const pluginSourceLines = plugin;
|
|
383
528
|
const plugins = [
|
|
384
529
|
pluginFrontmatter,
|
|
385
|
-
|
|
386
|
-
|
|
530
|
+
plugin$1,
|
|
531
|
+
plugin$2,
|
|
387
532
|
pluginNpmUrl,
|
|
388
|
-
|
|
389
|
-
|
|
533
|
+
plugin$3,
|
|
534
|
+
plugin
|
|
390
535
|
];
|
|
391
536
|
const builtInPlugins = plugins;
|
|
392
537
|
function cleanNode(node) {
|
|
@@ -445,10 +590,8 @@ class Transformer {
|
|
|
445
590
|
keys ?? (keys = this.plugins.map((plugin2) => plugin2.name));
|
|
446
591
|
for (const assets of keys.map((key) => this.assetsMap[key])) {
|
|
447
592
|
if (assets) {
|
|
448
|
-
if (assets.styles)
|
|
449
|
-
|
|
450
|
-
if (assets.scripts)
|
|
451
|
-
scripts.push(...assets.scripts);
|
|
593
|
+
if (assets.styles) styles2.push(...assets.styles);
|
|
594
|
+
if (assets.scripts) scripts.push(...assets.scripts);
|
|
452
595
|
}
|
|
453
596
|
}
|
|
454
597
|
return {
|
|
@@ -465,7 +608,7 @@ class Transformer {
|
|
|
465
608
|
}
|
|
466
609
|
}
|
|
467
610
|
const transformerVersions = {
|
|
468
|
-
"markmap-lib": "0.17.
|
|
611
|
+
"markmap-lib": "0.17.3-alpha.1"
|
|
469
612
|
};
|
|
470
613
|
export {
|
|
471
614
|
Transformer,
|
package/dist/index.js
CHANGED
|
@@ -8,9 +8,6 @@ const md_mark = require("markdown-it-mark");
|
|
|
8
8
|
const md_sub = require("markdown-it-sub");
|
|
9
9
|
const md_sup = require("markdown-it-sup");
|
|
10
10
|
const plugins = require("./plugins.js");
|
|
11
|
-
require("yaml");
|
|
12
|
-
require("highlight.js");
|
|
13
|
-
require("@iktakahiro/markdown-it-katex");
|
|
14
11
|
function initializeMarkdownIt() {
|
|
15
12
|
const md = MarkdownIt({
|
|
16
13
|
html: true,
|
|
@@ -100,10 +97,8 @@ class Transformer {
|
|
|
100
97
|
keys ?? (keys = this.plugins.map((plugin) => plugin.name));
|
|
101
98
|
for (const assets of keys.map((key) => this.assetsMap[key])) {
|
|
102
99
|
if (assets) {
|
|
103
|
-
if (assets.styles)
|
|
104
|
-
|
|
105
|
-
if (assets.scripts)
|
|
106
|
-
scripts.push(...assets.scripts);
|
|
100
|
+
if (assets.styles) styles.push(...assets.styles);
|
|
101
|
+
if (assets.scripts) scripts.push(...assets.scripts);
|
|
107
102
|
}
|
|
108
103
|
}
|
|
109
104
|
return {
|
|
@@ -120,7 +115,7 @@ class Transformer {
|
|
|
120
115
|
}
|
|
121
116
|
}
|
|
122
117
|
const transformerVersions = {
|
|
123
|
-
"markmap-lib": "0.17.
|
|
118
|
+
"markmap-lib": "0.17.3-alpha.1"
|
|
124
119
|
};
|
|
125
120
|
exports.Transformer = Transformer;
|
|
126
121
|
exports.builtInPlugins = builtInPlugins;
|
package/dist/index.mjs
CHANGED
|
@@ -6,9 +6,6 @@ import md_mark from "markdown-it-mark";
|
|
|
6
6
|
import md_sub from "markdown-it-sub";
|
|
7
7
|
import md_sup from "markdown-it-sup";
|
|
8
8
|
import { plugins, createTransformHooks } from "./plugins.mjs";
|
|
9
|
-
import "yaml";
|
|
10
|
-
import "highlight.js";
|
|
11
|
-
import "@iktakahiro/markdown-it-katex";
|
|
12
9
|
function initializeMarkdownIt() {
|
|
13
10
|
const md = MarkdownIt({
|
|
14
11
|
html: true,
|
|
@@ -98,10 +95,8 @@ class Transformer {
|
|
|
98
95
|
keys ?? (keys = this.plugins.map((plugin) => plugin.name));
|
|
99
96
|
for (const assets of keys.map((key) => this.assetsMap[key])) {
|
|
100
97
|
if (assets) {
|
|
101
|
-
if (assets.styles)
|
|
102
|
-
|
|
103
|
-
if (assets.scripts)
|
|
104
|
-
scripts.push(...assets.scripts);
|
|
98
|
+
if (assets.styles) styles.push(...assets.styles);
|
|
99
|
+
if (assets.scripts) scripts.push(...assets.scripts);
|
|
105
100
|
}
|
|
106
101
|
}
|
|
107
102
|
return {
|
|
@@ -118,7 +113,7 @@ class Transformer {
|
|
|
118
113
|
}
|
|
119
114
|
}
|
|
120
115
|
const transformerVersions = {
|
|
121
|
-
"markmap-lib": "0.17.
|
|
116
|
+
"markmap-lib": "0.17.3-alpha.1"
|
|
122
117
|
};
|
|
123
118
|
export {
|
|
124
119
|
Transformer,
|
package/dist/index.no-plugins.js
CHANGED
|
@@ -105,10 +105,8 @@ class Transformer {
|
|
|
105
105
|
keys ?? (keys = this.plugins.map((plugin) => plugin.name));
|
|
106
106
|
for (const assets of keys.map((key) => this.assetsMap[key])) {
|
|
107
107
|
if (assets) {
|
|
108
|
-
if (assets.styles)
|
|
109
|
-
|
|
110
|
-
if (assets.scripts)
|
|
111
|
-
scripts.push(...assets.scripts);
|
|
108
|
+
if (assets.styles) styles.push(...assets.styles);
|
|
109
|
+
if (assets.scripts) scripts.push(...assets.scripts);
|
|
112
110
|
}
|
|
113
111
|
}
|
|
114
112
|
return {
|
|
@@ -125,7 +123,7 @@ class Transformer {
|
|
|
125
123
|
}
|
|
126
124
|
}
|
|
127
125
|
const transformerVersions = {
|
|
128
|
-
"markmap-lib": "0.17.
|
|
126
|
+
"markmap-lib": "0.17.3-alpha.1"
|
|
129
127
|
};
|
|
130
128
|
exports.Transformer = Transformer;
|
|
131
129
|
exports.builtInPlugins = builtInPlugins;
|
|
@@ -103,10 +103,8 @@ class Transformer {
|
|
|
103
103
|
keys ?? (keys = this.plugins.map((plugin) => plugin.name));
|
|
104
104
|
for (const assets of keys.map((key) => this.assetsMap[key])) {
|
|
105
105
|
if (assets) {
|
|
106
|
-
if (assets.styles)
|
|
107
|
-
|
|
108
|
-
if (assets.scripts)
|
|
109
|
-
scripts.push(...assets.scripts);
|
|
106
|
+
if (assets.styles) styles.push(...assets.styles);
|
|
107
|
+
if (assets.scripts) scripts.push(...assets.scripts);
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
return {
|
|
@@ -123,7 +121,7 @@ class Transformer {
|
|
|
123
121
|
}
|
|
124
122
|
}
|
|
125
123
|
const transformerVersions = {
|
|
126
|
-
"markmap-lib": "0.17.
|
|
124
|
+
"markmap-lib": "0.17.3-alpha.1"
|
|
127
125
|
};
|
|
128
126
|
export {
|
|
129
127
|
Transformer,
|
package/dist/plugins.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const markmapCommon = require("markmap-common");
|
|
4
4
|
const yaml = require("yaml");
|
|
5
5
|
const hljs = require("highlight.js");
|
|
6
|
-
const katexPlugin = require("@
|
|
6
|
+
const katexPlugin = require("@vscode/markdown-it-katex");
|
|
7
7
|
function createTransformHooks(transformer) {
|
|
8
8
|
return {
|
|
9
9
|
transformer,
|
|
@@ -47,7 +47,6 @@ const plugin$3 = definePlugin({
|
|
|
47
47
|
return {};
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
const pluginCheckbox = plugin$3;
|
|
51
50
|
const name$4 = "frontmatter";
|
|
52
51
|
const pluginFrontmatter = definePlugin({
|
|
53
52
|
name: name$4,
|
|
@@ -55,11 +54,9 @@ const pluginFrontmatter = definePlugin({
|
|
|
55
54
|
transformHooks.beforeParse.tap((_md, context) => {
|
|
56
55
|
var _a;
|
|
57
56
|
const { content } = context;
|
|
58
|
-
if (!/^---\r?\n/.test(content))
|
|
59
|
-
return;
|
|
57
|
+
if (!/^---\r?\n/.test(content)) return;
|
|
60
58
|
const match = /\n---\r?\n/.exec(content);
|
|
61
|
-
if (!match)
|
|
62
|
-
return;
|
|
59
|
+
if (!match) return;
|
|
63
60
|
const raw = content.slice(4, match.index).trimEnd();
|
|
64
61
|
let frontmatter;
|
|
65
62
|
try {
|
|
@@ -84,41 +81,36 @@ const pluginFrontmatter = definePlugin({
|
|
|
84
81
|
}
|
|
85
82
|
});
|
|
86
83
|
function normalizeMarkmapJsonOptions(options) {
|
|
87
|
-
if (!options)
|
|
88
|
-
return;
|
|
84
|
+
if (!options) return;
|
|
89
85
|
["color", "extraJs", "extraCss"].forEach((key) => {
|
|
90
|
-
if (options[key] != null)
|
|
91
|
-
options[key] = normalizeStringArray(options[key]);
|
|
86
|
+
if (options[key] != null) options[key] = normalizeStringArray(options[key]);
|
|
92
87
|
});
|
|
93
88
|
["duration", "maxWidth", "initialExpandLevel"].forEach((key) => {
|
|
94
|
-
if (options[key] != null)
|
|
95
|
-
options[key] = normalizeNumber(options[key]);
|
|
89
|
+
if (options[key] != null) options[key] = normalizeNumber(options[key]);
|
|
96
90
|
});
|
|
97
91
|
return options;
|
|
98
92
|
}
|
|
99
93
|
function normalizeStringArray(value) {
|
|
100
94
|
let result;
|
|
101
|
-
if (typeof value === "string")
|
|
102
|
-
result = [value];
|
|
95
|
+
if (typeof value === "string") result = [value];
|
|
103
96
|
else if (Array.isArray(value))
|
|
104
97
|
result = value.filter((item) => item && typeof item === "string");
|
|
105
98
|
return (result == null ? void 0 : result.length) ? result : void 0;
|
|
106
99
|
}
|
|
107
100
|
function normalizeNumber(value) {
|
|
108
|
-
if (isNaN(+value))
|
|
109
|
-
return;
|
|
101
|
+
if (isNaN(+value)) return;
|
|
110
102
|
return +value;
|
|
111
103
|
}
|
|
112
104
|
const name$3 = "hljs";
|
|
113
105
|
const preloadScripts$1 = [
|
|
114
|
-
`@highlightjs/cdn-assets@${"11.
|
|
106
|
+
`@highlightjs/cdn-assets@${"11.10.0"}/highlight.min.js`
|
|
115
107
|
].map((path) => markmapCommon.buildJSItem(path));
|
|
116
108
|
const styles$1 = [
|
|
117
|
-
`@highlightjs/cdn-assets@${"11.
|
|
109
|
+
`@highlightjs/cdn-assets@${"11.10.0"}/styles/default.min.css`
|
|
118
110
|
].map((path) => markmapCommon.buildCSSItem(path));
|
|
119
111
|
const config$1 = {
|
|
120
112
|
versions: {
|
|
121
|
-
hljs: "11.
|
|
113
|
+
hljs: "11.10.0"
|
|
122
114
|
},
|
|
123
115
|
preloadScripts: preloadScripts$1,
|
|
124
116
|
styles: styles$1
|
|
@@ -147,21 +139,20 @@ const plugin$2 = definePlugin({
|
|
|
147
139
|
};
|
|
148
140
|
}
|
|
149
141
|
});
|
|
150
|
-
const pluginHljs = plugin$2;
|
|
151
142
|
const name$2 = "katex";
|
|
152
143
|
const preloadScripts = [
|
|
153
|
-
`katex@${"0.16.
|
|
144
|
+
`katex@${"0.16.11"}/dist/katex.min.js`
|
|
154
145
|
].map((path) => markmapCommon.buildJSItem(path));
|
|
155
146
|
const webfontloader = markmapCommon.buildJSItem(
|
|
156
147
|
`webfontloader@${"1.6.28"}/webfontloader.js`
|
|
157
148
|
);
|
|
158
149
|
webfontloader.data.defer = true;
|
|
159
|
-
const styles = [`katex@${"0.16.
|
|
150
|
+
const styles = [`katex@${"0.16.11"}/dist/katex.min.css`].map(
|
|
160
151
|
(path) => markmapCommon.buildCSSItem(path)
|
|
161
152
|
);
|
|
162
153
|
const config = {
|
|
163
154
|
versions: {
|
|
164
|
-
katex: "0.16.
|
|
155
|
+
katex: "0.16.11",
|
|
165
156
|
webfontloader: "1.6.28"
|
|
166
157
|
},
|
|
167
158
|
preloadScripts,
|
|
@@ -230,7 +221,6 @@ const plugin$1 = definePlugin({
|
|
|
230
221
|
};
|
|
231
222
|
}
|
|
232
223
|
});
|
|
233
|
-
const pluginKatex = plugin$1;
|
|
234
224
|
const name$1 = "npmUrl";
|
|
235
225
|
const pluginNpmUrl = definePlugin({
|
|
236
226
|
name: name$1,
|
|
@@ -276,21 +266,20 @@ const plugin = definePlugin({
|
|
|
276
266
|
return {};
|
|
277
267
|
}
|
|
278
268
|
});
|
|
279
|
-
const pluginSourceLines = plugin;
|
|
280
269
|
const plugins = [
|
|
281
270
|
pluginFrontmatter,
|
|
282
|
-
|
|
283
|
-
|
|
271
|
+
plugin$1,
|
|
272
|
+
plugin$2,
|
|
284
273
|
pluginNpmUrl,
|
|
285
|
-
|
|
286
|
-
|
|
274
|
+
plugin$3,
|
|
275
|
+
plugin
|
|
287
276
|
];
|
|
288
277
|
exports.createTransformHooks = createTransformHooks;
|
|
289
278
|
exports.definePlugin = definePlugin;
|
|
290
|
-
exports.pluginCheckbox =
|
|
279
|
+
exports.pluginCheckbox = plugin$3;
|
|
291
280
|
exports.pluginFrontmatter = pluginFrontmatter;
|
|
292
|
-
exports.pluginHljs =
|
|
293
|
-
exports.pluginKatex =
|
|
281
|
+
exports.pluginHljs = plugin$2;
|
|
282
|
+
exports.pluginKatex = plugin$1;
|
|
294
283
|
exports.pluginNpmUrl = pluginNpmUrl;
|
|
295
|
-
exports.pluginSourceLines =
|
|
284
|
+
exports.pluginSourceLines = plugin;
|
|
296
285
|
exports.plugins = plugins;
|