markmap-lib 0.15.9-alpha.5 → 0.16.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/browser/index.iife.js +417 -482
- package/dist/browser/index.mjs +242 -248
- package/dist/index.d.ts +1 -3
- package/dist/index.js +17 -314
- package/dist/index.mjs +18 -315
- package/dist/index.no-plugins.js +136 -0
- package/dist/index.no-plugins.mjs +136 -0
- package/dist/plugins/checkbox/index.d.ts +2 -0
- package/dist/plugins/frontmatter/index.d.ts +2 -0
- package/dist/plugins/hljs/index.browser.d.ts +2 -0
- package/dist/plugins/hljs/index.d.ts +2 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/katex/index.browser.d.ts +2 -0
- package/dist/plugins/katex/index.d.ts +2 -0
- package/dist/plugins/npm-url/index.d.ts +2 -0
- package/dist/plugins/prism/index.browser.d.ts +2 -0
- package/dist/plugins/prism/index.d.ts +2 -0
- package/dist/plugins/source-lines/index.d.ts +2 -0
- package/dist/plugins.js +307 -0
- package/dist/plugins.mjs +307 -0
- package/dist/transform.d.ts +3 -9
- package/package.json +23 -7
- package/dist/constants.d.ts +0 -4
- package/dist/plugins/checkbox.d.ts +0 -2
- package/dist/plugins/frontmatter.d.ts +0 -2
- package/dist/plugins/hljs.browser.d.ts +0 -2
- package/dist/plugins/hljs.d.ts +0 -2
- package/dist/plugins/katex.browser.d.ts +0 -2
- package/dist/plugins/katex.d.ts +0 -2
- package/dist/plugins/npm-url.d.ts +0 -2
- package/dist/plugins/prism.browser.d.ts +0 -2
- package/dist/plugins/prism.d.ts +0 -2
- /package/dist/plugins/{hljs.config.d.ts → hljs/config.d.ts} +0 -0
- /package/dist/plugins/{katex.config.d.ts → katex/config.d.ts} +0 -0
- /package/dist/plugins/{prism.config.d.ts → prism/config.d.ts} +0 -0
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
(function(exports, require$$0) {
|
|
2
2
|
"use strict";
|
|
3
|
-
const template = '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="UTF-8">\n<meta name="viewport" content="width=device-width, initial-scale=1.0">\n<meta http-equiv="X-UA-Compatible" content="ie=edge">\n<title>Markmap</title>\n<style>\n* {\n margin: 0;\n padding: 0;\n}\n#mindmap {\n display: block;\n width: 100vw;\n height: 100vh;\n}\n</style>\n<!--CSS-->\n</head>\n<body>\n<svg id="mindmap"></svg>\n<!--JS-->\n</body>\n</html>\n';
|
|
4
|
-
const baseJsPaths = [
|
|
5
|
-
`d3@${"7.8.5"}/dist/d3.min.js`,
|
|
6
|
-
`markmap-view@${"0.15.9-alpha.5"}/dist/browser/index.js`
|
|
7
|
-
];
|
|
8
|
-
const svg_marked = `<svg width="16" height="16" fill="currentColor" viewBox="0 -3 24 24"><path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"/></svg>`;
|
|
9
|
-
const svg_unmarked = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 -3 24 24"><path fill-rule="evenodd" d="M6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1zM3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-5z" clip-rule="evenodd"/></svg>`;
|
|
10
3
|
const testPath = "npm2url/dist/index.cjs";
|
|
11
4
|
const defaultProviders = {
|
|
12
5
|
jsdelivr: (path) => `https://cdn.jsdelivr.net/npm/${path}`,
|
|
@@ -98,75 +91,6 @@
|
|
|
98
91
|
}
|
|
99
92
|
}
|
|
100
93
|
}
|
|
101
|
-
const escapeChars = {
|
|
102
|
-
"&": "&",
|
|
103
|
-
"<": "<",
|
|
104
|
-
'"': """
|
|
105
|
-
};
|
|
106
|
-
function escapeHtml$1(html2) {
|
|
107
|
-
return html2.replace(/[&<"]/g, (m) => escapeChars[m]);
|
|
108
|
-
}
|
|
109
|
-
function escapeScript(content) {
|
|
110
|
-
return content.replace(/<(\/script>)/g, "\\x3c$2");
|
|
111
|
-
}
|
|
112
|
-
function htmlOpen(tagName, attrs) {
|
|
113
|
-
const attrStr = attrs ? Object.entries(attrs).map(([key, value]) => {
|
|
114
|
-
if (value == null || value === false)
|
|
115
|
-
return;
|
|
116
|
-
key = ` ${escapeHtml$1(key)}`;
|
|
117
|
-
if (value === true)
|
|
118
|
-
return key;
|
|
119
|
-
return `${key}="${escapeHtml$1(value)}"`;
|
|
120
|
-
}).filter(Boolean).join("") : "";
|
|
121
|
-
return `<${tagName}${attrStr}>`;
|
|
122
|
-
}
|
|
123
|
-
function htmlClose(tagName) {
|
|
124
|
-
return `</${tagName}>`;
|
|
125
|
-
}
|
|
126
|
-
function wrapHtml(tagName, content, attrs) {
|
|
127
|
-
if (content == null)
|
|
128
|
-
return htmlOpen(tagName, attrs);
|
|
129
|
-
return htmlOpen(tagName, attrs) + (content || "") + htmlClose(tagName);
|
|
130
|
-
}
|
|
131
|
-
function buildCode(fn, args) {
|
|
132
|
-
const params = args.map((arg) => {
|
|
133
|
-
if (typeof arg === "function")
|
|
134
|
-
return arg.toString();
|
|
135
|
-
return JSON.stringify(arg ?? null);
|
|
136
|
-
}).join(",");
|
|
137
|
-
return `(${fn.toString()})(${params})`;
|
|
138
|
-
}
|
|
139
|
-
function persistJS(items, context) {
|
|
140
|
-
return items.map((item) => {
|
|
141
|
-
if (item.type === "script") {
|
|
142
|
-
const { textContent: textContent2, ...rest } = item.data;
|
|
143
|
-
return wrapHtml(
|
|
144
|
-
"script",
|
|
145
|
-
textContent2 || "",
|
|
146
|
-
rest
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
if (item.type === "iife") {
|
|
150
|
-
const { fn, getParams } = item.data;
|
|
151
|
-
return wrapHtml(
|
|
152
|
-
"script",
|
|
153
|
-
escapeScript(buildCode(fn, (getParams == null ? void 0 : getParams(context)) || []))
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
return "";
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
function persistCSS(items) {
|
|
160
|
-
return items.map((item) => {
|
|
161
|
-
if (item.type === "stylesheet") {
|
|
162
|
-
return wrapHtml("link", null, {
|
|
163
|
-
rel: "stylesheet",
|
|
164
|
-
...item.data
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
return wrapHtml("style", item.data);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
94
|
Math.random().toString(36).slice(2, 8);
|
|
171
95
|
function noop() {
|
|
172
96
|
}
|
|
@@ -14073,7 +13997,7 @@
|
|
|
14073
13997
|
const SELECTOR_LIST = /^[uo]l$/;
|
|
14074
13998
|
const SELECTOR_LIST_ITEM = /^li$/;
|
|
14075
13999
|
const defaultOptions = {
|
|
14076
|
-
selector: "h1,h2,h3,h4,h5,h6,ul,ol,li,table,pre,p>img:
|
|
14000
|
+
selector: "h1,h2,h3,h4,h5,h6,ul,ol,li,table,pre,p>img:only-child",
|
|
14077
14001
|
selectorWrapper: "div,p",
|
|
14078
14002
|
selectorNesting: "ul,ol,li",
|
|
14079
14003
|
selectorPreserveTag: "table,pre,img"
|
|
@@ -14115,14 +14039,18 @@
|
|
|
14115
14039
|
const $el = elMap[node.id];
|
|
14116
14040
|
$el.contents().each((_, child) => {
|
|
14117
14041
|
if (child.type === "comment") {
|
|
14118
|
-
const
|
|
14119
|
-
if (
|
|
14042
|
+
const data22 = child.data.trim();
|
|
14043
|
+
if (data22.startsWith(MARKMAP_COMMENT_PREFIX)) {
|
|
14120
14044
|
node.comments || (node.comments = []);
|
|
14121
|
-
node.comments.push(
|
|
14045
|
+
node.comments.push(data22.slice(MARKMAP_COMMENT_PREFIX.length).trim());
|
|
14122
14046
|
$2(child).remove();
|
|
14123
14047
|
}
|
|
14124
14048
|
}
|
|
14125
14049
|
});
|
|
14050
|
+
const data2 = $el.data();
|
|
14051
|
+
if (data2 && Object.keys(data2).length) {
|
|
14052
|
+
node.data = data2;
|
|
14053
|
+
}
|
|
14126
14054
|
node.html = (($el.is(options.selectorPreserveTag) ? $2.html($el) : $el.html()) || "").trimEnd();
|
|
14127
14055
|
});
|
|
14128
14056
|
return rootNode;
|
|
@@ -14204,11 +14132,16 @@
|
|
|
14204
14132
|
content: htmlNode.html,
|
|
14205
14133
|
children: next2() || []
|
|
14206
14134
|
};
|
|
14135
|
+
if (htmlNode.data) {
|
|
14136
|
+
node.payload = {
|
|
14137
|
+
...htmlNode.data
|
|
14138
|
+
};
|
|
14139
|
+
}
|
|
14207
14140
|
if (htmlNode.comments) {
|
|
14208
14141
|
if (htmlNode.comments.includes("foldAll")) {
|
|
14209
|
-
node.payload = { fold: 2 };
|
|
14142
|
+
node.payload = { ...node.payload, fold: 2 };
|
|
14210
14143
|
} else if (htmlNode.comments.includes("fold")) {
|
|
14211
|
-
node.payload = { fold: 1 };
|
|
14144
|
+
node.payload = { ...node.payload, fold: 1 };
|
|
14212
14145
|
}
|
|
14213
14146
|
}
|
|
14214
14147
|
return node;
|
|
@@ -18025,229 +17958,6 @@
|
|
|
18025
17958
|
env = env || {};
|
|
18026
17959
|
return this.renderer.render(this.parseInline(str2, env), this.options, env);
|
|
18027
17960
|
};
|
|
18028
|
-
const rkatex = (md, options) => {
|
|
18029
|
-
const backslash = "\\";
|
|
18030
|
-
const dollar = "$";
|
|
18031
|
-
const opts = options || {};
|
|
18032
|
-
const delimiter = opts.delimiter || dollar;
|
|
18033
|
-
if (delimiter.length !== 1) {
|
|
18034
|
-
throw new Error("invalid delimiter");
|
|
18035
|
-
}
|
|
18036
|
-
const katex = require$$0;
|
|
18037
|
-
const renderKatex = (source, displayMode) => katex.renderToString(
|
|
18038
|
-
source,
|
|
18039
|
-
{
|
|
18040
|
-
displayMode,
|
|
18041
|
-
throwOnError: false
|
|
18042
|
-
}
|
|
18043
|
-
);
|
|
18044
|
-
const parseBlockKatex = (state, startLine, endLine) => {
|
|
18045
|
-
let haveEndMarker = false;
|
|
18046
|
-
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
18047
|
-
let max = state.eMarks[startLine];
|
|
18048
|
-
if (pos + 1 > max) {
|
|
18049
|
-
return false;
|
|
18050
|
-
}
|
|
18051
|
-
const marker = state.src.charAt(pos);
|
|
18052
|
-
if (marker !== delimiter) {
|
|
18053
|
-
return false;
|
|
18054
|
-
}
|
|
18055
|
-
let mem = pos;
|
|
18056
|
-
pos = state.skipChars(pos, marker);
|
|
18057
|
-
let len = pos - mem;
|
|
18058
|
-
if (len !== 2) {
|
|
18059
|
-
return false;
|
|
18060
|
-
}
|
|
18061
|
-
let nextLine = startLine;
|
|
18062
|
-
for (; ; ) {
|
|
18063
|
-
++nextLine;
|
|
18064
|
-
if (nextLine >= endLine) {
|
|
18065
|
-
break;
|
|
18066
|
-
}
|
|
18067
|
-
pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
18068
|
-
max = state.eMarks[nextLine];
|
|
18069
|
-
if (pos < max && state.tShift[nextLine] < state.blkIndent) {
|
|
18070
|
-
break;
|
|
18071
|
-
}
|
|
18072
|
-
if (state.src.charAt(pos) !== delimiter) {
|
|
18073
|
-
continue;
|
|
18074
|
-
}
|
|
18075
|
-
if (state.tShift[nextLine] - state.blkIndent >= 4) {
|
|
18076
|
-
continue;
|
|
18077
|
-
}
|
|
18078
|
-
pos = state.skipChars(pos, marker);
|
|
18079
|
-
if (pos - mem < len) {
|
|
18080
|
-
continue;
|
|
18081
|
-
}
|
|
18082
|
-
pos = state.skipSpaces(pos);
|
|
18083
|
-
if (pos < max) {
|
|
18084
|
-
continue;
|
|
18085
|
-
}
|
|
18086
|
-
haveEndMarker = true;
|
|
18087
|
-
break;
|
|
18088
|
-
}
|
|
18089
|
-
len = state.tShift[startLine];
|
|
18090
|
-
state.line = nextLine + (haveEndMarker ? 1 : 0);
|
|
18091
|
-
const content = state.getLines(startLine + 1, nextLine, len, true).replace(/[ \n]+/g, " ").trim();
|
|
18092
|
-
state.tokens.push({
|
|
18093
|
-
type: "katex",
|
|
18094
|
-
params: null,
|
|
18095
|
-
content,
|
|
18096
|
-
lines: [startLine, state.line],
|
|
18097
|
-
level: state.level,
|
|
18098
|
-
block: true
|
|
18099
|
-
});
|
|
18100
|
-
return true;
|
|
18101
|
-
};
|
|
18102
|
-
const parseInlineKatex = (state, silent) => {
|
|
18103
|
-
const start = state.pos;
|
|
18104
|
-
const max = state.posMax;
|
|
18105
|
-
let pos = start;
|
|
18106
|
-
if (state.src.charAt(pos) !== delimiter) {
|
|
18107
|
-
return false;
|
|
18108
|
-
}
|
|
18109
|
-
++pos;
|
|
18110
|
-
while (pos < max && state.src.charAt(pos) === delimiter) {
|
|
18111
|
-
++pos;
|
|
18112
|
-
}
|
|
18113
|
-
const marker = state.src.slice(start, pos);
|
|
18114
|
-
if (marker.length > 2) {
|
|
18115
|
-
return false;
|
|
18116
|
-
}
|
|
18117
|
-
const spanStart = pos;
|
|
18118
|
-
let escapedDepth = 0;
|
|
18119
|
-
while (pos < max) {
|
|
18120
|
-
const char = state.src.charAt(pos);
|
|
18121
|
-
if (char === "{" && (pos == 0 || state.src.charAt(pos - 1) != backslash)) {
|
|
18122
|
-
escapedDepth += 1;
|
|
18123
|
-
} else if (char === "}" && (pos == 0 || state.src.charAt(pos - 1) != backslash)) {
|
|
18124
|
-
escapedDepth -= 1;
|
|
18125
|
-
if (escapedDepth < 0) {
|
|
18126
|
-
return false;
|
|
18127
|
-
}
|
|
18128
|
-
} else if (char === delimiter && escapedDepth === 0) {
|
|
18129
|
-
const matchStart = pos;
|
|
18130
|
-
let matchEnd = pos + 1;
|
|
18131
|
-
while (matchEnd < max && state.src.charAt(matchEnd) === delimiter) {
|
|
18132
|
-
++matchEnd;
|
|
18133
|
-
}
|
|
18134
|
-
if (matchEnd - matchStart === marker.length) {
|
|
18135
|
-
if (!silent) {
|
|
18136
|
-
const content = state.src.slice(spanStart, matchStart).replace(/[ \n]+/g, " ").trim();
|
|
18137
|
-
state.push({ type: "katex", content, block: marker.length > 1, level: state.level });
|
|
18138
|
-
}
|
|
18139
|
-
state.pos = matchEnd;
|
|
18140
|
-
return true;
|
|
18141
|
-
}
|
|
18142
|
-
}
|
|
18143
|
-
pos += 1;
|
|
18144
|
-
}
|
|
18145
|
-
if (!silent) {
|
|
18146
|
-
state.pending += marker;
|
|
18147
|
-
}
|
|
18148
|
-
state.pos += marker.length;
|
|
18149
|
-
return true;
|
|
18150
|
-
};
|
|
18151
|
-
md.inline.ruler.push("katex", parseInlineKatex, options);
|
|
18152
|
-
md.block.ruler.push("katex", parseBlockKatex, options);
|
|
18153
|
-
md.renderer.rules.katex = (tokens, idx) => renderKatex(tokens[idx].content, tokens[idx].block);
|
|
18154
|
-
md.renderer.rules.katex.delimiter = delimiter;
|
|
18155
|
-
};
|
|
18156
|
-
var remarkableKatex = rkatex;
|
|
18157
|
-
const remarkableKatex$1 = /* @__PURE__ */ getDefaultExportFromCjs(remarkableKatex);
|
|
18158
|
-
const name$4 = "katex";
|
|
18159
|
-
const preloadScripts$1 = [
|
|
18160
|
-
`katex@${"0.16.8"}/dist/katex.min.js`
|
|
18161
|
-
].map((path) => buildJSItem(path));
|
|
18162
|
-
const webfontloader = buildJSItem(
|
|
18163
|
-
`webfontloader@${"1.6.28"}/webfontloader.js`
|
|
18164
|
-
);
|
|
18165
|
-
webfontloader.data.defer = true;
|
|
18166
|
-
const styles$1 = [`katex@${"0.16.8"}/dist/katex.min.css`].map(
|
|
18167
|
-
(path) => buildCSSItem(path)
|
|
18168
|
-
);
|
|
18169
|
-
const config$1 = {
|
|
18170
|
-
versions: {
|
|
18171
|
-
katex: "0.16.8",
|
|
18172
|
-
webfontloader: "1.6.28"
|
|
18173
|
-
},
|
|
18174
|
-
preloadScripts: preloadScripts$1,
|
|
18175
|
-
scripts: [
|
|
18176
|
-
{
|
|
18177
|
-
type: "iife",
|
|
18178
|
-
data: {
|
|
18179
|
-
fn: (getMarkmap) => {
|
|
18180
|
-
window.WebFontConfig = {
|
|
18181
|
-
custom: {
|
|
18182
|
-
families: [
|
|
18183
|
-
"KaTeX_AMS",
|
|
18184
|
-
"KaTeX_Caligraphic:n4,n7",
|
|
18185
|
-
"KaTeX_Fraktur:n4,n7",
|
|
18186
|
-
"KaTeX_Main:n4,n7,i4,i7",
|
|
18187
|
-
"KaTeX_Math:i4,i7",
|
|
18188
|
-
"KaTeX_Script",
|
|
18189
|
-
"KaTeX_SansSerif:n4,n7,i4",
|
|
18190
|
-
"KaTeX_Size1",
|
|
18191
|
-
"KaTeX_Size2",
|
|
18192
|
-
"KaTeX_Size3",
|
|
18193
|
-
"KaTeX_Size4",
|
|
18194
|
-
"KaTeX_Typewriter"
|
|
18195
|
-
]
|
|
18196
|
-
},
|
|
18197
|
-
active: () => {
|
|
18198
|
-
getMarkmap().refreshHook.call();
|
|
18199
|
-
}
|
|
18200
|
-
};
|
|
18201
|
-
},
|
|
18202
|
-
getParams({ getMarkmap }) {
|
|
18203
|
-
return [getMarkmap];
|
|
18204
|
-
}
|
|
18205
|
-
}
|
|
18206
|
-
},
|
|
18207
|
-
webfontloader
|
|
18208
|
-
],
|
|
18209
|
-
styles: styles$1
|
|
18210
|
-
};
|
|
18211
|
-
function addDefaultVersions(paths, name2, version) {
|
|
18212
|
-
return paths.map((path) => {
|
|
18213
|
-
if (typeof path === "string" && !path.includes("://")) {
|
|
18214
|
-
if (!path.startsWith("npm:")) {
|
|
18215
|
-
path = `npm:${path}`;
|
|
18216
|
-
}
|
|
18217
|
-
const prefixLength = 4 + name2.length;
|
|
18218
|
-
if (path.startsWith(`npm:${name2}/`)) {
|
|
18219
|
-
path = `${path.slice(0, prefixLength)}@${version}${path.slice(
|
|
18220
|
-
prefixLength
|
|
18221
|
-
)}`;
|
|
18222
|
-
}
|
|
18223
|
-
}
|
|
18224
|
-
return path;
|
|
18225
|
-
});
|
|
18226
|
-
}
|
|
18227
|
-
function patchJSItem(urlBuilder, item) {
|
|
18228
|
-
if (item.type === "script" && item.data.src) {
|
|
18229
|
-
return {
|
|
18230
|
-
...item,
|
|
18231
|
-
data: {
|
|
18232
|
-
...item.data,
|
|
18233
|
-
src: urlBuilder.getFullUrl(item.data.src)
|
|
18234
|
-
}
|
|
18235
|
-
};
|
|
18236
|
-
}
|
|
18237
|
-
return item;
|
|
18238
|
-
}
|
|
18239
|
-
function patchCSSItem(urlBuilder, item) {
|
|
18240
|
-
if (item.type === "stylesheet" && item.data.href) {
|
|
18241
|
-
return {
|
|
18242
|
-
...item,
|
|
18243
|
-
data: {
|
|
18244
|
-
...item.data,
|
|
18245
|
-
href: urlBuilder.getFullUrl(item.data.href)
|
|
18246
|
-
}
|
|
18247
|
-
};
|
|
18248
|
-
}
|
|
18249
|
-
return item;
|
|
18250
|
-
}
|
|
18251
17961
|
function createTransformHooks(transformer) {
|
|
18252
17962
|
return {
|
|
18253
17963
|
transformer,
|
|
@@ -18261,69 +17971,43 @@
|
|
|
18261
17971
|
function definePlugin(plugin2) {
|
|
18262
17972
|
return plugin2;
|
|
18263
17973
|
}
|
|
18264
|
-
const
|
|
18265
|
-
|
|
18266
|
-
|
|
17974
|
+
const svgMarked = '<svg width="16" height="16" viewBox="0 -3 24 24"><path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"/></svg>\n';
|
|
17975
|
+
const svgUnmarked = '<svg width="16" height="16" viewBox="0 -3 24 24"><path fill-rule="evenodd" d="M6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1zM3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-5z" clip-rule="evenodd"/></svg>\n';
|
|
17976
|
+
const name$5 = "checkbox";
|
|
17977
|
+
const images = {
|
|
17978
|
+
" ": svgUnmarked.trim(),
|
|
17979
|
+
x: svgMarked.trim()
|
|
17980
|
+
};
|
|
17981
|
+
const plugin$3 = definePlugin({
|
|
17982
|
+
name: name$5,
|
|
18267
17983
|
transform(transformHooks) {
|
|
18268
|
-
var _a2, _b, _c, _d;
|
|
18269
|
-
let loading;
|
|
18270
|
-
const preloadScripts2 = ((_b = (_a2 = plugin$2.config) == null ? void 0 : _a2.preloadScripts) == null ? void 0 : _b.map(
|
|
18271
|
-
(item) => patchJSItem(transformHooks.transformer.urlBuilder, item)
|
|
18272
|
-
)) || [];
|
|
18273
|
-
const autoload = () => {
|
|
18274
|
-
loading || (loading = loadJS(preloadScripts2));
|
|
18275
|
-
return loading;
|
|
18276
|
-
};
|
|
18277
|
-
const renderKatex = (source, displayMode) => {
|
|
18278
|
-
const { katex } = window;
|
|
18279
|
-
if (katex) {
|
|
18280
|
-
return katex.renderToString(source, {
|
|
18281
|
-
displayMode,
|
|
18282
|
-
throwOnError: false
|
|
18283
|
-
});
|
|
18284
|
-
}
|
|
18285
|
-
autoload().then(() => {
|
|
18286
|
-
transformHooks.retransform.call();
|
|
18287
|
-
});
|
|
18288
|
-
return source;
|
|
18289
|
-
};
|
|
18290
|
-
let enableFeature = noop;
|
|
18291
17984
|
transformHooks.parser.tap((md) => {
|
|
18292
|
-
md.
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
|
|
18301
|
-
|
|
18302
|
-
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18307
|
-
|
|
18308
|
-
["extraJs", "extraCss"].forEach((key) => {
|
|
18309
|
-
var _a4, _b2;
|
|
18310
|
-
const value = markmap[key];
|
|
18311
|
-
if (value) {
|
|
18312
|
-
markmap[key] = addDefaultVersions(
|
|
18313
|
-
value,
|
|
18314
|
-
name$4,
|
|
18315
|
-
((_b2 = (_a4 = plugin$2.config) == null ? void 0 : _a4.versions) == null ? void 0 : _b2.katex) || ""
|
|
18316
|
-
);
|
|
17985
|
+
md.core.ruler.before(
|
|
17986
|
+
"inline",
|
|
17987
|
+
"checkbox",
|
|
17988
|
+
(state) => {
|
|
17989
|
+
for (let i2 = 2; i2 < state.tokens.length; i2 += 1) {
|
|
17990
|
+
const token = state.tokens[i2];
|
|
17991
|
+
if (token.type === "inline" && token.content) {
|
|
17992
|
+
const prevType = state.tokens[i2 - 1].type;
|
|
17993
|
+
const prevPrevType = state.tokens[i2 - 2].type;
|
|
17994
|
+
if (prevType === "heading_open" || prevType === "paragraph_open" && prevPrevType === "list_item_open") {
|
|
17995
|
+
token.content = token.content.replace(
|
|
17996
|
+
/^\[(.)\] /,
|
|
17997
|
+
(m, g) => images[g] ? `${images[g]} ` : m
|
|
17998
|
+
);
|
|
17999
|
+
}
|
|
18000
|
+
}
|
|
18317
18001
|
}
|
|
18318
|
-
|
|
18319
|
-
|
|
18002
|
+
return false;
|
|
18003
|
+
},
|
|
18004
|
+
{}
|
|
18005
|
+
);
|
|
18320
18006
|
});
|
|
18321
|
-
return {
|
|
18322
|
-
styles: (_c = plugin$2.config) == null ? void 0 : _c.styles,
|
|
18323
|
-
scripts: (_d = plugin$2.config) == null ? void 0 : _d.scripts
|
|
18324
|
-
};
|
|
18007
|
+
return {};
|
|
18325
18008
|
}
|
|
18326
18009
|
});
|
|
18010
|
+
const pluginCheckbox = plugin$3;
|
|
18327
18011
|
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
|
|
18328
18012
|
function isNothing(subject) {
|
|
18329
18013
|
return typeof subject === "undefined" || subject === null;
|
|
@@ -21012,9 +20696,10 @@
|
|
|
21012
20696
|
safeLoadAll,
|
|
21013
20697
|
safeDump
|
|
21014
20698
|
};
|
|
21015
|
-
const
|
|
21016
|
-
const
|
|
21017
|
-
|
|
20699
|
+
const yaml = jsYaml;
|
|
20700
|
+
const name$4 = "frontmatter";
|
|
20701
|
+
const pluginFrontmatter = definePlugin({
|
|
20702
|
+
name: name$4,
|
|
21018
20703
|
transform(transformHooks) {
|
|
21019
20704
|
transformHooks.beforeParse.tap((md, context) => {
|
|
21020
20705
|
const { content } = context;
|
|
@@ -21024,18 +20709,18 @@
|
|
|
21024
20709
|
if (!match)
|
|
21025
20710
|
return;
|
|
21026
20711
|
const raw = content.slice(4, match.index);
|
|
21027
|
-
let
|
|
20712
|
+
let frontmatter;
|
|
21028
20713
|
try {
|
|
21029
|
-
|
|
21030
|
-
if (
|
|
21031
|
-
|
|
21032
|
-
|
|
20714
|
+
frontmatter = yaml.load(raw);
|
|
20715
|
+
if (frontmatter == null ? void 0 : frontmatter.markmap) {
|
|
20716
|
+
frontmatter.markmap = normalizeMarkmapJsonOptions(
|
|
20717
|
+
frontmatter.markmap
|
|
21033
20718
|
);
|
|
21034
20719
|
}
|
|
21035
20720
|
} catch {
|
|
21036
20721
|
return;
|
|
21037
20722
|
}
|
|
21038
|
-
context.frontmatter =
|
|
20723
|
+
context.frontmatter = frontmatter;
|
|
21039
20724
|
context.content = content.slice(match.index + match[0].length);
|
|
21040
20725
|
context.contentLineOffset = content.slice(0, match.index).split("\n").length + 1;
|
|
21041
20726
|
});
|
|
@@ -21068,54 +20753,51 @@
|
|
|
21068
20753
|
return;
|
|
21069
20754
|
return +value;
|
|
21070
20755
|
}
|
|
21071
|
-
|
|
21072
|
-
|
|
21073
|
-
|
|
21074
|
-
|
|
21075
|
-
|
|
21076
|
-
|
|
21077
|
-
|
|
21078
|
-
if (markmap) {
|
|
21079
|
-
["extraJs", "extraCss"].forEach((key) => {
|
|
21080
|
-
const value = markmap[key];
|
|
21081
|
-
if (value) {
|
|
21082
|
-
markmap[key] = value.map((path) => {
|
|
21083
|
-
if (path.startsWith("npm:")) {
|
|
21084
|
-
return transformHooks.transformer.urlBuilder.getFullUrl(
|
|
21085
|
-
path.slice(4)
|
|
21086
|
-
);
|
|
21087
|
-
}
|
|
21088
|
-
return path;
|
|
21089
|
-
});
|
|
21090
|
-
}
|
|
21091
|
-
});
|
|
20756
|
+
function patchJSItem(urlBuilder, item) {
|
|
20757
|
+
if (item.type === "script" && item.data.src) {
|
|
20758
|
+
return {
|
|
20759
|
+
...item,
|
|
20760
|
+
data: {
|
|
20761
|
+
...item.data,
|
|
20762
|
+
src: urlBuilder.getFullUrl(item.data.src)
|
|
21092
20763
|
}
|
|
21093
|
-
}
|
|
21094
|
-
return {};
|
|
20764
|
+
};
|
|
21095
20765
|
}
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
20766
|
+
return item;
|
|
20767
|
+
}
|
|
20768
|
+
function patchCSSItem(urlBuilder, item) {
|
|
20769
|
+
if (item.type === "stylesheet" && item.data.href) {
|
|
20770
|
+
return {
|
|
20771
|
+
...item,
|
|
20772
|
+
data: {
|
|
20773
|
+
...item.data,
|
|
20774
|
+
href: urlBuilder.getFullUrl(item.data.href)
|
|
20775
|
+
}
|
|
20776
|
+
};
|
|
20777
|
+
}
|
|
20778
|
+
return item;
|
|
20779
|
+
}
|
|
20780
|
+
const name$3 = "hljs";
|
|
20781
|
+
const preloadScripts$1 = [
|
|
21099
20782
|
`@highlightjs/cdn-assets@${"11.8.0"}/highlight.min.js`
|
|
21100
20783
|
].map((path) => buildJSItem(path));
|
|
21101
|
-
const styles = [
|
|
20784
|
+
const styles$1 = [
|
|
21102
20785
|
`@highlightjs/cdn-assets@${"11.8.0"}/styles/default.min.css`
|
|
21103
|
-
// `highlight.js@${process.env.HLJS_VERSION}/styles/default.css`,
|
|
21104
20786
|
].map((path) => buildCSSItem(path));
|
|
21105
|
-
const config = {
|
|
20787
|
+
const config$1 = {
|
|
21106
20788
|
versions: {
|
|
21107
20789
|
hljs: "11.8.0"
|
|
21108
20790
|
},
|
|
21109
|
-
preloadScripts,
|
|
21110
|
-
styles
|
|
20791
|
+
preloadScripts: preloadScripts$1,
|
|
20792
|
+
styles: styles$1
|
|
21111
20793
|
};
|
|
21112
|
-
const plugin$
|
|
21113
|
-
name: name$
|
|
21114
|
-
config,
|
|
20794
|
+
const plugin$2 = definePlugin({
|
|
20795
|
+
name: name$3,
|
|
20796
|
+
config: config$1,
|
|
21115
20797
|
transform(transformHooks) {
|
|
21116
20798
|
var _a2, _b, _c;
|
|
21117
20799
|
let loading;
|
|
21118
|
-
const preloadScripts2 = ((_b = (_a2 = plugin$
|
|
20800
|
+
const preloadScripts2 = ((_b = (_a2 = plugin$2.config) == null ? void 0 : _a2.preloadScripts) == null ? void 0 : _b.map(
|
|
21119
20801
|
(item) => patchJSItem(transformHooks.transformer.urlBuilder, item)
|
|
21120
20802
|
)) || [];
|
|
21121
20803
|
const autoload = () => {
|
|
@@ -21140,46 +20822,345 @@
|
|
|
21140
20822
|
});
|
|
21141
20823
|
transformHooks.beforeParse.tap((_, context) => {
|
|
21142
20824
|
enableFeature = () => {
|
|
21143
|
-
context.features[name$
|
|
20825
|
+
context.features[name$3] = true;
|
|
21144
20826
|
};
|
|
21145
20827
|
});
|
|
21146
20828
|
return {
|
|
21147
|
-
styles: (_c = plugin$
|
|
20829
|
+
styles: (_c = plugin$2.config) == null ? void 0 : _c.styles
|
|
21148
20830
|
};
|
|
21149
20831
|
}
|
|
21150
20832
|
});
|
|
21151
|
-
const
|
|
21152
|
-
const
|
|
21153
|
-
|
|
20833
|
+
const pluginHljs = plugin$2;
|
|
20834
|
+
const rkatex = (md, options) => {
|
|
20835
|
+
const backslash = "\\";
|
|
20836
|
+
const dollar = "$";
|
|
20837
|
+
const opts = options || {};
|
|
20838
|
+
const delimiter = opts.delimiter || dollar;
|
|
20839
|
+
if (delimiter.length !== 1) {
|
|
20840
|
+
throw new Error("invalid delimiter");
|
|
20841
|
+
}
|
|
20842
|
+
const katex = require$$0;
|
|
20843
|
+
const renderKatex = (source, displayMode) => katex.renderToString(
|
|
20844
|
+
source,
|
|
20845
|
+
{
|
|
20846
|
+
displayMode,
|
|
20847
|
+
throwOnError: false
|
|
20848
|
+
}
|
|
20849
|
+
);
|
|
20850
|
+
const parseBlockKatex = (state, startLine, endLine) => {
|
|
20851
|
+
let haveEndMarker = false;
|
|
20852
|
+
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
20853
|
+
let max = state.eMarks[startLine];
|
|
20854
|
+
if (pos + 1 > max) {
|
|
20855
|
+
return false;
|
|
20856
|
+
}
|
|
20857
|
+
const marker = state.src.charAt(pos);
|
|
20858
|
+
if (marker !== delimiter) {
|
|
20859
|
+
return false;
|
|
20860
|
+
}
|
|
20861
|
+
let mem = pos;
|
|
20862
|
+
pos = state.skipChars(pos, marker);
|
|
20863
|
+
let len = pos - mem;
|
|
20864
|
+
if (len !== 2) {
|
|
20865
|
+
return false;
|
|
20866
|
+
}
|
|
20867
|
+
let nextLine = startLine;
|
|
20868
|
+
for (; ; ) {
|
|
20869
|
+
++nextLine;
|
|
20870
|
+
if (nextLine >= endLine) {
|
|
20871
|
+
break;
|
|
20872
|
+
}
|
|
20873
|
+
pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
20874
|
+
max = state.eMarks[nextLine];
|
|
20875
|
+
if (pos < max && state.tShift[nextLine] < state.blkIndent) {
|
|
20876
|
+
break;
|
|
20877
|
+
}
|
|
20878
|
+
if (state.src.charAt(pos) !== delimiter) {
|
|
20879
|
+
continue;
|
|
20880
|
+
}
|
|
20881
|
+
if (state.tShift[nextLine] - state.blkIndent >= 4) {
|
|
20882
|
+
continue;
|
|
20883
|
+
}
|
|
20884
|
+
pos = state.skipChars(pos, marker);
|
|
20885
|
+
if (pos - mem < len) {
|
|
20886
|
+
continue;
|
|
20887
|
+
}
|
|
20888
|
+
pos = state.skipSpaces(pos);
|
|
20889
|
+
if (pos < max) {
|
|
20890
|
+
continue;
|
|
20891
|
+
}
|
|
20892
|
+
haveEndMarker = true;
|
|
20893
|
+
break;
|
|
20894
|
+
}
|
|
20895
|
+
len = state.tShift[startLine];
|
|
20896
|
+
state.line = nextLine + (haveEndMarker ? 1 : 0);
|
|
20897
|
+
const content = state.getLines(startLine + 1, nextLine, len, true).replace(/[ \n]+/g, " ").trim();
|
|
20898
|
+
state.tokens.push({
|
|
20899
|
+
type: "katex",
|
|
20900
|
+
params: null,
|
|
20901
|
+
content,
|
|
20902
|
+
lines: [startLine, state.line],
|
|
20903
|
+
level: state.level,
|
|
20904
|
+
block: true
|
|
20905
|
+
});
|
|
20906
|
+
return true;
|
|
20907
|
+
};
|
|
20908
|
+
const parseInlineKatex = (state, silent) => {
|
|
20909
|
+
const start = state.pos;
|
|
20910
|
+
const max = state.posMax;
|
|
20911
|
+
let pos = start;
|
|
20912
|
+
if (state.src.charAt(pos) !== delimiter) {
|
|
20913
|
+
return false;
|
|
20914
|
+
}
|
|
20915
|
+
++pos;
|
|
20916
|
+
while (pos < max && state.src.charAt(pos) === delimiter) {
|
|
20917
|
+
++pos;
|
|
20918
|
+
}
|
|
20919
|
+
const marker = state.src.slice(start, pos);
|
|
20920
|
+
if (marker.length > 2) {
|
|
20921
|
+
return false;
|
|
20922
|
+
}
|
|
20923
|
+
const spanStart = pos;
|
|
20924
|
+
let escapedDepth = 0;
|
|
20925
|
+
while (pos < max) {
|
|
20926
|
+
const char = state.src.charAt(pos);
|
|
20927
|
+
if (char === "{" && (pos == 0 || state.src.charAt(pos - 1) != backslash)) {
|
|
20928
|
+
escapedDepth += 1;
|
|
20929
|
+
} else if (char === "}" && (pos == 0 || state.src.charAt(pos - 1) != backslash)) {
|
|
20930
|
+
escapedDepth -= 1;
|
|
20931
|
+
if (escapedDepth < 0) {
|
|
20932
|
+
return false;
|
|
20933
|
+
}
|
|
20934
|
+
} else if (char === delimiter && escapedDepth === 0) {
|
|
20935
|
+
const matchStart = pos;
|
|
20936
|
+
let matchEnd = pos + 1;
|
|
20937
|
+
while (matchEnd < max && state.src.charAt(matchEnd) === delimiter) {
|
|
20938
|
+
++matchEnd;
|
|
20939
|
+
}
|
|
20940
|
+
if (matchEnd - matchStart === marker.length) {
|
|
20941
|
+
if (!silent) {
|
|
20942
|
+
const content = state.src.slice(spanStart, matchStart).replace(/[ \n]+/g, " ").trim();
|
|
20943
|
+
state.push({ type: "katex", content, block: marker.length > 1, level: state.level });
|
|
20944
|
+
}
|
|
20945
|
+
state.pos = matchEnd;
|
|
20946
|
+
return true;
|
|
20947
|
+
}
|
|
20948
|
+
}
|
|
20949
|
+
pos += 1;
|
|
20950
|
+
}
|
|
20951
|
+
if (!silent) {
|
|
20952
|
+
state.pending += marker;
|
|
20953
|
+
}
|
|
20954
|
+
state.pos += marker.length;
|
|
20955
|
+
return true;
|
|
20956
|
+
};
|
|
20957
|
+
md.inline.ruler.push("katex", parseInlineKatex, options);
|
|
20958
|
+
md.block.ruler.push("katex", parseBlockKatex, options);
|
|
20959
|
+
md.renderer.rules.katex = (tokens, idx) => renderKatex(tokens[idx].content, tokens[idx].block);
|
|
20960
|
+
md.renderer.rules.katex.delimiter = delimiter;
|
|
20961
|
+
};
|
|
20962
|
+
var remarkableKatex = rkatex;
|
|
20963
|
+
const remarkableKatex$1 = /* @__PURE__ */ getDefaultExportFromCjs(remarkableKatex);
|
|
20964
|
+
const name$2 = "katex";
|
|
20965
|
+
const preloadScripts = [
|
|
20966
|
+
`katex@${"0.16.8"}/dist/katex.min.js`
|
|
20967
|
+
].map((path) => buildJSItem(path));
|
|
20968
|
+
const webfontloader = buildJSItem(
|
|
20969
|
+
`webfontloader@${"1.6.28"}/webfontloader.js`
|
|
20970
|
+
);
|
|
20971
|
+
webfontloader.data.defer = true;
|
|
20972
|
+
const styles = [`katex@${"0.16.8"}/dist/katex.min.css`].map(
|
|
20973
|
+
(path) => buildCSSItem(path)
|
|
20974
|
+
);
|
|
20975
|
+
const config = {
|
|
20976
|
+
versions: {
|
|
20977
|
+
katex: "0.16.8",
|
|
20978
|
+
webfontloader: "1.6.28"
|
|
20979
|
+
},
|
|
20980
|
+
preloadScripts,
|
|
20981
|
+
scripts: [
|
|
20982
|
+
{
|
|
20983
|
+
type: "iife",
|
|
20984
|
+
data: {
|
|
20985
|
+
fn: (getMarkmap) => {
|
|
20986
|
+
window.WebFontConfig = {
|
|
20987
|
+
custom: {
|
|
20988
|
+
families: [
|
|
20989
|
+
"KaTeX_AMS",
|
|
20990
|
+
"KaTeX_Caligraphic:n4,n7",
|
|
20991
|
+
"KaTeX_Fraktur:n4,n7",
|
|
20992
|
+
"KaTeX_Main:n4,n7,i4,i7",
|
|
20993
|
+
"KaTeX_Math:i4,i7",
|
|
20994
|
+
"KaTeX_Script",
|
|
20995
|
+
"KaTeX_SansSerif:n4,n7,i4",
|
|
20996
|
+
"KaTeX_Size1",
|
|
20997
|
+
"KaTeX_Size2",
|
|
20998
|
+
"KaTeX_Size3",
|
|
20999
|
+
"KaTeX_Size4",
|
|
21000
|
+
"KaTeX_Typewriter"
|
|
21001
|
+
]
|
|
21002
|
+
},
|
|
21003
|
+
active: () => {
|
|
21004
|
+
getMarkmap().refreshHook.call();
|
|
21005
|
+
}
|
|
21006
|
+
};
|
|
21007
|
+
},
|
|
21008
|
+
getParams({ getMarkmap }) {
|
|
21009
|
+
return [getMarkmap];
|
|
21010
|
+
}
|
|
21011
|
+
}
|
|
21012
|
+
},
|
|
21013
|
+
webfontloader
|
|
21014
|
+
],
|
|
21015
|
+
styles
|
|
21016
|
+
};
|
|
21017
|
+
function addDefaultVersions(paths, name2, version) {
|
|
21018
|
+
return paths.map((path) => {
|
|
21019
|
+
if (typeof path === "string" && !path.includes("://")) {
|
|
21020
|
+
if (!path.startsWith("npm:")) {
|
|
21021
|
+
path = `npm:${path}`;
|
|
21022
|
+
}
|
|
21023
|
+
const prefixLength = 4 + name2.length;
|
|
21024
|
+
if (path.startsWith(`npm:${name2}/`)) {
|
|
21025
|
+
path = `${path.slice(0, prefixLength)}@${version}${path.slice(
|
|
21026
|
+
prefixLength
|
|
21027
|
+
)}`;
|
|
21028
|
+
}
|
|
21029
|
+
}
|
|
21030
|
+
return path;
|
|
21031
|
+
});
|
|
21032
|
+
}
|
|
21033
|
+
const plugin$1 = definePlugin({
|
|
21034
|
+
name: name$2,
|
|
21035
|
+
config,
|
|
21154
21036
|
transform(transformHooks) {
|
|
21037
|
+
var _a2, _b, _c, _d;
|
|
21038
|
+
let loading;
|
|
21039
|
+
const preloadScripts2 = ((_b = (_a2 = plugin$1.config) == null ? void 0 : _a2.preloadScripts) == null ? void 0 : _b.map(
|
|
21040
|
+
(item) => patchJSItem(transformHooks.transformer.urlBuilder, item)
|
|
21041
|
+
)) || [];
|
|
21042
|
+
const autoload = () => {
|
|
21043
|
+
loading || (loading = loadJS(preloadScripts2));
|
|
21044
|
+
return loading;
|
|
21045
|
+
};
|
|
21046
|
+
const renderKatex = (source, displayMode) => {
|
|
21047
|
+
const { katex } = window;
|
|
21048
|
+
if (katex) {
|
|
21049
|
+
return katex.renderToString(source, {
|
|
21050
|
+
displayMode,
|
|
21051
|
+
throwOnError: false
|
|
21052
|
+
});
|
|
21053
|
+
}
|
|
21054
|
+
autoload().then(() => {
|
|
21055
|
+
transformHooks.retransform.call();
|
|
21056
|
+
});
|
|
21057
|
+
return source;
|
|
21058
|
+
};
|
|
21059
|
+
let enableFeature = noop;
|
|
21155
21060
|
transformHooks.parser.tap((md) => {
|
|
21156
|
-
md.
|
|
21157
|
-
|
|
21158
|
-
|
|
21159
|
-
(
|
|
21160
|
-
|
|
21161
|
-
|
|
21162
|
-
|
|
21163
|
-
|
|
21164
|
-
|
|
21165
|
-
|
|
21166
|
-
|
|
21167
|
-
|
|
21168
|
-
|
|
21169
|
-
|
|
21170
|
-
|
|
21061
|
+
md.use(remarkableKatex$1);
|
|
21062
|
+
md.renderer.rules.katex = (tokens, idx) => {
|
|
21063
|
+
enableFeature();
|
|
21064
|
+
const result = renderKatex(tokens[idx].content, !!tokens[idx].block);
|
|
21065
|
+
return result;
|
|
21066
|
+
};
|
|
21067
|
+
});
|
|
21068
|
+
transformHooks.beforeParse.tap((_, context) => {
|
|
21069
|
+
enableFeature = () => {
|
|
21070
|
+
context.features[name$2] = true;
|
|
21071
|
+
};
|
|
21072
|
+
});
|
|
21073
|
+
transformHooks.afterParse.tap((_, context) => {
|
|
21074
|
+
var _a3;
|
|
21075
|
+
const markmap = (_a3 = context.frontmatter) == null ? void 0 : _a3.markmap;
|
|
21076
|
+
if (markmap) {
|
|
21077
|
+
["extraJs", "extraCss"].forEach((key) => {
|
|
21078
|
+
var _a4, _b2;
|
|
21079
|
+
const value = markmap[key];
|
|
21080
|
+
if (value) {
|
|
21081
|
+
markmap[key] = addDefaultVersions(
|
|
21082
|
+
value,
|
|
21083
|
+
name$2,
|
|
21084
|
+
((_b2 = (_a4 = plugin$1.config) == null ? void 0 : _a4.versions) == null ? void 0 : _b2.katex) || ""
|
|
21085
|
+
);
|
|
21086
|
+
}
|
|
21087
|
+
});
|
|
21088
|
+
}
|
|
21089
|
+
});
|
|
21090
|
+
return {
|
|
21091
|
+
styles: (_c = plugin$1.config) == null ? void 0 : _c.styles,
|
|
21092
|
+
scripts: (_d = plugin$1.config) == null ? void 0 : _d.scripts
|
|
21093
|
+
};
|
|
21094
|
+
}
|
|
21095
|
+
});
|
|
21096
|
+
const pluginKatex = plugin$1;
|
|
21097
|
+
const name$1 = "npmUrl";
|
|
21098
|
+
const pluginNpmUrl = definePlugin({
|
|
21099
|
+
name: name$1,
|
|
21100
|
+
transform(transformHooks) {
|
|
21101
|
+
transformHooks.afterParse.tap((_, context) => {
|
|
21102
|
+
const { frontmatter } = context;
|
|
21103
|
+
const markmap = frontmatter == null ? void 0 : frontmatter.markmap;
|
|
21104
|
+
if (markmap) {
|
|
21105
|
+
["extraJs", "extraCss"].forEach((key) => {
|
|
21106
|
+
const value = markmap[key];
|
|
21107
|
+
if (value) {
|
|
21108
|
+
markmap[key] = value.map((path) => {
|
|
21109
|
+
if (path.startsWith("npm:")) {
|
|
21110
|
+
return transformHooks.transformer.urlBuilder.getFullUrl(
|
|
21111
|
+
path.slice(4)
|
|
21112
|
+
);
|
|
21171
21113
|
}
|
|
21172
|
-
|
|
21114
|
+
return path;
|
|
21115
|
+
});
|
|
21173
21116
|
}
|
|
21174
|
-
|
|
21175
|
-
|
|
21176
|
-
|
|
21177
|
-
|
|
21117
|
+
});
|
|
21118
|
+
}
|
|
21119
|
+
});
|
|
21120
|
+
return {};
|
|
21121
|
+
}
|
|
21122
|
+
});
|
|
21123
|
+
const name = "sourceLines";
|
|
21124
|
+
const plugin = definePlugin({
|
|
21125
|
+
name,
|
|
21126
|
+
transform(transformHooks) {
|
|
21127
|
+
transformHooks.parser.tap((md) => {
|
|
21128
|
+
Object.entries(md.renderer.rules).forEach(([key, value]) => {
|
|
21129
|
+
if (typeof value === "function") {
|
|
21130
|
+
md.renderer.rules[key] = patchRule(value);
|
|
21131
|
+
} else {
|
|
21132
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
21133
|
+
value[k] = patchRule(v);
|
|
21134
|
+
});
|
|
21135
|
+
}
|
|
21136
|
+
});
|
|
21178
21137
|
});
|
|
21179
21138
|
return {};
|
|
21180
21139
|
}
|
|
21181
21140
|
});
|
|
21182
|
-
|
|
21141
|
+
function patchRule(rule, _key) {
|
|
21142
|
+
return wrapFunction(rule, (render2, tokens, idx, ...rest) => {
|
|
21143
|
+
let html2 = render2(tokens, idx, ...rest);
|
|
21144
|
+
const { lines } = tokens[idx];
|
|
21145
|
+
if (lines) {
|
|
21146
|
+
html2 = html2.replace(
|
|
21147
|
+
/^<[\w-]+/,
|
|
21148
|
+
(m) => `${m} data-lines="${lines.join(",")}"`
|
|
21149
|
+
);
|
|
21150
|
+
}
|
|
21151
|
+
return html2;
|
|
21152
|
+
});
|
|
21153
|
+
}
|
|
21154
|
+
const pluginSourceLines = plugin;
|
|
21155
|
+
const plugins = [
|
|
21156
|
+
pluginFrontmatter,
|
|
21157
|
+
pluginKatex,
|
|
21158
|
+
pluginHljs,
|
|
21159
|
+
pluginNpmUrl,
|
|
21160
|
+
pluginCheckbox,
|
|
21161
|
+
pluginSourceLines
|
|
21162
|
+
];
|
|
21163
|
+
const builtInPlugins = plugins;
|
|
21183
21164
|
function cleanNode(node) {
|
|
21184
21165
|
while (!node.content && node.children.length === 1) {
|
|
21185
21166
|
node = node.children[0];
|
|
@@ -21196,11 +21177,11 @@
|
|
|
21196
21177
|
};
|
|
21197
21178
|
}
|
|
21198
21179
|
class Transformer {
|
|
21199
|
-
constructor(
|
|
21180
|
+
constructor(plugins2 = builtInPlugins) {
|
|
21200
21181
|
this.assetsMap = {};
|
|
21201
21182
|
this.urlBuilder = new UrlBuilder();
|
|
21202
21183
|
this.hooks = createTransformHooks(this);
|
|
21203
|
-
this.plugins =
|
|
21184
|
+
this.plugins = plugins2.map(
|
|
21204
21185
|
(plugin2) => typeof plugin2 === "function" ? plugin2() : plugin2
|
|
21205
21186
|
);
|
|
21206
21187
|
const assetsMap = {};
|
|
@@ -21269,58 +21250,12 @@
|
|
|
21269
21250
|
const keys = this.plugins.map((plugin2) => plugin2.name).filter((name2) => features[name2]);
|
|
21270
21251
|
return this.getAssets(keys);
|
|
21271
21252
|
}
|
|
21272
|
-
fillTemplate(root2, assets, extra) {
|
|
21273
|
-
extra = {
|
|
21274
|
-
...extra
|
|
21275
|
-
};
|
|
21276
|
-
extra.baseJs ?? (extra.baseJs = baseJsPaths.map((path) => this.urlBuilder.getFullUrl(path)).map((path) => buildJSItem(path)));
|
|
21277
|
-
const { scripts, styles: styles2 } = assets;
|
|
21278
|
-
const cssList = [...styles2 ? persistCSS(styles2) : []];
|
|
21279
|
-
const context = {
|
|
21280
|
-
getMarkmap: () => window.markmap,
|
|
21281
|
-
getOptions: extra.getOptions,
|
|
21282
|
-
jsonOptions: extra.jsonOptions,
|
|
21283
|
-
root: root2
|
|
21284
|
-
};
|
|
21285
|
-
const jsList = [
|
|
21286
|
-
...persistJS(
|
|
21287
|
-
[
|
|
21288
|
-
...extra.baseJs,
|
|
21289
|
-
...scripts || [],
|
|
21290
|
-
{
|
|
21291
|
-
type: "iife",
|
|
21292
|
-
data: {
|
|
21293
|
-
fn: (getMarkmap, getOptions, root22, jsonOptions) => {
|
|
21294
|
-
const markmap = getMarkmap();
|
|
21295
|
-
window.mm = markmap.Markmap.create(
|
|
21296
|
-
"svg#mindmap",
|
|
21297
|
-
(getOptions || markmap.deriveOptions)(jsonOptions),
|
|
21298
|
-
root22
|
|
21299
|
-
);
|
|
21300
|
-
},
|
|
21301
|
-
getParams: ({ getMarkmap, getOptions, root: root22, jsonOptions }) => {
|
|
21302
|
-
return [getMarkmap, getOptions, root22, jsonOptions];
|
|
21303
|
-
}
|
|
21304
|
-
}
|
|
21305
|
-
}
|
|
21306
|
-
],
|
|
21307
|
-
context
|
|
21308
|
-
)
|
|
21309
|
-
];
|
|
21310
|
-
const html2 = template.replace("<!--CSS-->", () => cssList.join("")).replace("<!--JS-->", () => jsList.join(""));
|
|
21311
|
-
return html2;
|
|
21312
|
-
}
|
|
21313
21253
|
}
|
|
21314
21254
|
const transformerVersions = {
|
|
21315
|
-
"markmap-lib": "
|
|
21316
|
-
d3: "7.8.5"
|
|
21255
|
+
"markmap-lib": "0.16.0"
|
|
21317
21256
|
};
|
|
21318
21257
|
exports.Transformer = Transformer;
|
|
21319
|
-
exports.
|
|
21320
|
-
exports.builtInPlugins = plugins;
|
|
21321
|
-
exports.svg_marked = svg_marked;
|
|
21322
|
-
exports.svg_unmarked = svg_unmarked;
|
|
21323
|
-
exports.template = template;
|
|
21258
|
+
exports.builtInPlugins = builtInPlugins;
|
|
21324
21259
|
exports.transformerVersions = transformerVersions;
|
|
21325
21260
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
21326
21261
|
})(this.markmap = this.markmap || {}, window.katex);
|