markmap-lib 0.17.3-alpha.2 → 0.17.3-alpha.4
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 +647 -277
- package/dist/browser/index.mjs +12 -164
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.no-plugins.js +1 -1
- package/dist/index.no-plugins.mjs +1 -1
- package/dist/plugins/katex/vendor.d.ts +2 -0
- package/dist/plugins.js +8 -4
- package/dist/plugins.mjs +8 -4
- package/package.json +7 -7
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 katexPluginModule from "@vscode/markdown-it-katex";
|
|
10
10
|
function initializeMarkdownIt() {
|
|
11
11
|
const md = MarkdownIt({
|
|
12
12
|
html: true,
|
|
@@ -189,162 +189,6 @@ const plugin$2 = definePlugin({
|
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
});
|
|
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);
|
|
348
192
|
function addDefaultVersions(paths, name2, version) {
|
|
349
193
|
return paths.map((path) => {
|
|
350
194
|
if (typeof path === "string" && !path.includes("://")) {
|
|
@@ -363,18 +207,18 @@ function addDefaultVersions(paths, name2, version) {
|
|
|
363
207
|
}
|
|
364
208
|
const name$2 = "katex";
|
|
365
209
|
const preloadScripts = [
|
|
366
|
-
`katex@${"0.16.
|
|
210
|
+
`katex@${"0.16.15"}/dist/katex.min.js`
|
|
367
211
|
].map((path) => buildJSItem(path));
|
|
368
212
|
const webfontloader = buildJSItem(
|
|
369
213
|
`webfontloader@${"1.6.28"}/webfontloader.js`
|
|
370
214
|
);
|
|
371
215
|
webfontloader.data.defer = true;
|
|
372
|
-
const styles = [`katex@${"0.16.
|
|
216
|
+
const styles = [`katex@${"0.16.15"}/dist/katex.min.css`].map(
|
|
373
217
|
(path) => buildCSSItem(path)
|
|
374
218
|
);
|
|
375
219
|
const config = {
|
|
376
220
|
versions: {
|
|
377
|
-
katex: "0.16.
|
|
221
|
+
katex: "0.16.15",
|
|
378
222
|
webfontloader: "1.6.28"
|
|
379
223
|
},
|
|
380
224
|
preloadScripts,
|
|
@@ -414,6 +258,10 @@ const config = {
|
|
|
414
258
|
],
|
|
415
259
|
styles
|
|
416
260
|
};
|
|
261
|
+
function interop(mod) {
|
|
262
|
+
return mod.default || mod;
|
|
263
|
+
}
|
|
264
|
+
const katexPlugin = interop(katexPluginModule);
|
|
417
265
|
const plugin$1 = definePlugin({
|
|
418
266
|
name: name$2,
|
|
419
267
|
config,
|
|
@@ -428,9 +276,9 @@ const plugin$1 = definePlugin({
|
|
|
428
276
|
return loading;
|
|
429
277
|
};
|
|
430
278
|
const renderKatex = (source, displayMode) => {
|
|
431
|
-
const { katex
|
|
432
|
-
if (
|
|
433
|
-
return
|
|
279
|
+
const { katex } = window;
|
|
280
|
+
if (katex) {
|
|
281
|
+
return katex.renderToString(source, {
|
|
434
282
|
displayMode,
|
|
435
283
|
throwOnError: false
|
|
436
284
|
});
|
|
@@ -608,7 +456,7 @@ class Transformer {
|
|
|
608
456
|
}
|
|
609
457
|
}
|
|
610
458
|
const transformerVersions = {
|
|
611
|
-
"markmap-lib": "0.17.3-alpha.
|
|
459
|
+
"markmap-lib": "0.17.3-alpha.4"
|
|
612
460
|
};
|
|
613
461
|
export {
|
|
614
462
|
Transformer,
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
package/dist/index.no-plugins.js
CHANGED
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
|
|
6
|
+
const katexPluginModule = require("@vscode/markdown-it-katex");
|
|
7
7
|
function createTransformHooks(transformer) {
|
|
8
8
|
return {
|
|
9
9
|
transformer,
|
|
@@ -141,18 +141,18 @@ const plugin$2 = definePlugin({
|
|
|
141
141
|
});
|
|
142
142
|
const name$2 = "katex";
|
|
143
143
|
const preloadScripts = [
|
|
144
|
-
`katex@${"0.16.
|
|
144
|
+
`katex@${"0.16.15"}/dist/katex.min.js`
|
|
145
145
|
].map((path) => markmapCommon.buildJSItem(path));
|
|
146
146
|
const webfontloader = markmapCommon.buildJSItem(
|
|
147
147
|
`webfontloader@${"1.6.28"}/webfontloader.js`
|
|
148
148
|
);
|
|
149
149
|
webfontloader.data.defer = true;
|
|
150
|
-
const styles = [`katex@${"0.16.
|
|
150
|
+
const styles = [`katex@${"0.16.15"}/dist/katex.min.css`].map(
|
|
151
151
|
(path) => markmapCommon.buildCSSItem(path)
|
|
152
152
|
);
|
|
153
153
|
const config = {
|
|
154
154
|
versions: {
|
|
155
|
-
katex: "0.16.
|
|
155
|
+
katex: "0.16.15",
|
|
156
156
|
webfontloader: "1.6.28"
|
|
157
157
|
},
|
|
158
158
|
preloadScripts,
|
|
@@ -192,6 +192,10 @@ const config = {
|
|
|
192
192
|
],
|
|
193
193
|
styles
|
|
194
194
|
};
|
|
195
|
+
function interop(mod) {
|
|
196
|
+
return mod.default || mod;
|
|
197
|
+
}
|
|
198
|
+
const katexPlugin = interop(katexPluginModule);
|
|
195
199
|
const plugin$1 = definePlugin({
|
|
196
200
|
name: name$2,
|
|
197
201
|
config,
|
package/dist/plugins.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hook, buildJSItem, buildCSSItem, noop, wrapFunction } from "markmap-common";
|
|
2
2
|
import { parse } from "yaml";
|
|
3
3
|
import hljs from "highlight.js";
|
|
4
|
-
import
|
|
4
|
+
import katexPluginModule from "@vscode/markdown-it-katex";
|
|
5
5
|
function createTransformHooks(transformer) {
|
|
6
6
|
return {
|
|
7
7
|
transformer,
|
|
@@ -139,18 +139,18 @@ const plugin$2 = definePlugin({
|
|
|
139
139
|
});
|
|
140
140
|
const name$2 = "katex";
|
|
141
141
|
const preloadScripts = [
|
|
142
|
-
`katex@${"0.16.
|
|
142
|
+
`katex@${"0.16.15"}/dist/katex.min.js`
|
|
143
143
|
].map((path) => buildJSItem(path));
|
|
144
144
|
const webfontloader = buildJSItem(
|
|
145
145
|
`webfontloader@${"1.6.28"}/webfontloader.js`
|
|
146
146
|
);
|
|
147
147
|
webfontloader.data.defer = true;
|
|
148
|
-
const styles = [`katex@${"0.16.
|
|
148
|
+
const styles = [`katex@${"0.16.15"}/dist/katex.min.css`].map(
|
|
149
149
|
(path) => buildCSSItem(path)
|
|
150
150
|
);
|
|
151
151
|
const config = {
|
|
152
152
|
versions: {
|
|
153
|
-
katex: "0.16.
|
|
153
|
+
katex: "0.16.15",
|
|
154
154
|
webfontloader: "1.6.28"
|
|
155
155
|
},
|
|
156
156
|
preloadScripts,
|
|
@@ -190,6 +190,10 @@ const config = {
|
|
|
190
190
|
],
|
|
191
191
|
styles
|
|
192
192
|
};
|
|
193
|
+
function interop(mod) {
|
|
194
|
+
return mod.default || mod;
|
|
195
|
+
}
|
|
196
|
+
const katexPlugin = interop(katexPluginModule);
|
|
193
197
|
const plugin$1 = definePlugin({
|
|
194
198
|
name: name$2,
|
|
195
199
|
config,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markmap-lib",
|
|
3
|
-
"version": "0.17.3-alpha.
|
|
3
|
+
"version": "0.17.3-alpha.4+be55d82",
|
|
4
4
|
"description": "Visualize your Markdown as mindmaps with Markmap",
|
|
5
5
|
"author": "Gerald <gera2ld@live.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"clean": "del-cli dist",
|
|
9
9
|
"build:types": "tsc",
|
|
10
10
|
"build:js": "vite build && TARGET=nodeLight vite build && TARGET=browserEs vite build && TARGET=browserJs vite build",
|
|
11
|
-
"build": "
|
|
12
|
-
"prepublishOnly": "
|
|
11
|
+
"build": "pnpm clean && pnpm /^build:/",
|
|
12
|
+
"prepublishOnly": "pnpm build",
|
|
13
13
|
"test": "jest test"
|
|
14
14
|
},
|
|
15
15
|
"publishConfig": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@highlightjs/cdn-assets": "^11.8.0",
|
|
62
62
|
"@types/katex": "^0.16.7",
|
|
63
63
|
"@types/markdown-it": "^14.0.0",
|
|
64
|
-
"markmap-common": "0.17.
|
|
64
|
+
"markmap-common": "0.17.3-alpha.4+be55d82",
|
|
65
65
|
"webfontloader": "^1.6.28"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"markdown-it-mark": "^4.0.0",
|
|
75
75
|
"markdown-it-sub": "^2.0.0",
|
|
76
76
|
"markdown-it-sup": "^2.0.0",
|
|
77
|
-
"markmap-html-parser": "0.17.3-alpha.
|
|
78
|
-
"markmap-view": "0.17.
|
|
77
|
+
"markmap-html-parser": "0.17.3-alpha.4+be55d82",
|
|
78
|
+
"markmap-view": "0.17.3-alpha.4+be55d82",
|
|
79
79
|
"prismjs": "^1.29.0",
|
|
80
80
|
"yaml": "^2.5.1"
|
|
81
81
|
},
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"^(.*\\.svg)\\?raw$": "$1"
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "be55d825cb73aab3d315dc2f4034ebe06a54759b"
|
|
100
100
|
}
|