markmap-lib 0.15.9-alpha.6 → 0.16.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 +135 -213
- package/dist/browser/index.mjs +37 -81
- package/dist/index.d.ts +1 -3
- package/dist/index.js +17 -352
- package/dist/index.mjs +18 -353
- 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/source-lines.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.6"}/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
|
}
|
|
@@ -14068,16 +13992,47 @@
|
|
|
14068
13992
|
const parse = getParse((content, options, isDocument2, context) => options.xmlMode || options._useHtmlParser2 ? parseDocument(content, options) : parseWithParse5(content, options, isDocument2, context));
|
|
14069
13993
|
const load$2 = getLoad(parse, (dom, options) => options.xmlMode || options._useHtmlParser2 ? render$1(dom, options) : renderWithParse5(dom));
|
|
14070
13994
|
load$2([]);
|
|
13995
|
+
const defaultSelectorRules = {
|
|
13996
|
+
"div,p": ({ $node }) => ({
|
|
13997
|
+
queue: $node.children()
|
|
13998
|
+
}),
|
|
13999
|
+
"h1,h2,h3,h4,h5,h6": ({ $node, getContent }) => ({
|
|
14000
|
+
...getContent($node.contents())
|
|
14001
|
+
}),
|
|
14002
|
+
"ul,ol": ({ $node }) => ({
|
|
14003
|
+
queue: $node.children(),
|
|
14004
|
+
nesting: true
|
|
14005
|
+
}),
|
|
14006
|
+
li: ({ $node, getContent }) => {
|
|
14007
|
+
const queue = $node.children().filter("ul,ol");
|
|
14008
|
+
let content;
|
|
14009
|
+
if ($node.contents().first().is("div,p")) {
|
|
14010
|
+
content = getContent($node.children().first());
|
|
14011
|
+
} else {
|
|
14012
|
+
let $contents = $node.contents();
|
|
14013
|
+
const i2 = $contents.index(queue);
|
|
14014
|
+
if (i2 >= 0)
|
|
14015
|
+
$contents = $contents.slice(0, i2);
|
|
14016
|
+
content = getContent($contents);
|
|
14017
|
+
}
|
|
14018
|
+
return {
|
|
14019
|
+
queue,
|
|
14020
|
+
nesting: true,
|
|
14021
|
+
...content
|
|
14022
|
+
};
|
|
14023
|
+
},
|
|
14024
|
+
"table,pre,p>img:only-child": ({ $node, getContent }) => ({
|
|
14025
|
+
...getContent($node)
|
|
14026
|
+
})
|
|
14027
|
+
};
|
|
14028
|
+
const defaultOptions = {
|
|
14029
|
+
selector: "h1,h2,h3,h4,h5,h6,ul,ol,li,table,pre,p>img:only-child",
|
|
14030
|
+
selectorRules: defaultSelectorRules
|
|
14031
|
+
};
|
|
14071
14032
|
const MARKMAP_COMMENT_PREFIX = "markmap: ";
|
|
14072
14033
|
const SELECTOR_HEADING = /^h[1-6]$/;
|
|
14073
14034
|
const SELECTOR_LIST = /^[uo]l$/;
|
|
14074
14035
|
const SELECTOR_LIST_ITEM = /^li$/;
|
|
14075
|
-
const defaultOptions = {
|
|
14076
|
-
selector: "h1,h2,h3,h4,h5,h6,ul,ol,li,table,pre,p>img:first-child:last-child",
|
|
14077
|
-
selectorWrapper: "div,p",
|
|
14078
|
-
selectorNesting: "ul,ol,li",
|
|
14079
|
-
selectorPreserveTag: "table,pre,img"
|
|
14080
|
-
};
|
|
14081
14036
|
function getLevel(tagName) {
|
|
14082
14037
|
if (SELECTOR_HEADING.test(tagName))
|
|
14083
14038
|
return +tagName[1];
|
|
@@ -14104,43 +14059,28 @@
|
|
|
14104
14059
|
childrenLevel: 0,
|
|
14105
14060
|
children: []
|
|
14106
14061
|
};
|
|
14107
|
-
const elMap = {
|
|
14108
|
-
[id]: $2("<div>")
|
|
14109
|
-
};
|
|
14110
14062
|
const headingStack = [];
|
|
14111
14063
|
let skippingHeading = 0;
|
|
14112
|
-
|
|
14113
|
-
walkTree(rootNode, (node, next2) => {
|
|
14114
|
-
next2();
|
|
14115
|
-
const $el = elMap[node.id];
|
|
14116
|
-
$el.contents().each((_, child) => {
|
|
14117
|
-
if (child.type === "comment") {
|
|
14118
|
-
const data22 = child.data.trim();
|
|
14119
|
-
if (data22.startsWith(MARKMAP_COMMENT_PREFIX)) {
|
|
14120
|
-
node.comments || (node.comments = []);
|
|
14121
|
-
node.comments.push(data22.slice(MARKMAP_COMMENT_PREFIX.length).trim());
|
|
14122
|
-
$2(child).remove();
|
|
14123
|
-
}
|
|
14124
|
-
}
|
|
14125
|
-
});
|
|
14126
|
-
const data2 = $el.data();
|
|
14127
|
-
if (data2 && Object.keys(data2).length) {
|
|
14128
|
-
node.data = data2;
|
|
14129
|
-
}
|
|
14130
|
-
node.html = (($el.is(options.selectorPreserveTag) ? $2.html($el) : $el.html()) || "").trimEnd();
|
|
14131
|
-
});
|
|
14064
|
+
checkNodes($root.children());
|
|
14132
14065
|
return rootNode;
|
|
14133
|
-
function addChild(
|
|
14134
|
-
|
|
14066
|
+
function addChild(props) {
|
|
14067
|
+
var _a2;
|
|
14068
|
+
const { parent: parent2 } = props;
|
|
14135
14069
|
const node = {
|
|
14136
14070
|
id: ++id,
|
|
14137
|
-
tag:
|
|
14138
|
-
|
|
14139
|
-
|
|
14071
|
+
tag: props.tagName,
|
|
14072
|
+
level: props.level,
|
|
14073
|
+
html: props.html,
|
|
14140
14074
|
childrenLevel: 0,
|
|
14141
|
-
children: nesting ? [] : void 0,
|
|
14075
|
+
children: props.nesting ? [] : void 0,
|
|
14142
14076
|
parent: parent2.id
|
|
14143
14077
|
};
|
|
14078
|
+
if ((_a2 = props.comments) == null ? void 0 : _a2.length) {
|
|
14079
|
+
node.comments = props.comments;
|
|
14080
|
+
}
|
|
14081
|
+
if (Object.keys(props.data || {}).length) {
|
|
14082
|
+
node.data = props.data;
|
|
14083
|
+
}
|
|
14144
14084
|
if (parent2.children) {
|
|
14145
14085
|
if (parent2.childrenLevel === 0 || parent2.childrenLevel > node.level) {
|
|
14146
14086
|
parent2.children = [];
|
|
@@ -14150,7 +14090,6 @@
|
|
|
14150
14090
|
parent2.children.push(node);
|
|
14151
14091
|
}
|
|
14152
14092
|
}
|
|
14153
|
-
elMap[node.id] = $child;
|
|
14154
14093
|
return node;
|
|
14155
14094
|
}
|
|
14156
14095
|
function getCurrentHeading(level) {
|
|
@@ -14160,45 +14099,64 @@
|
|
|
14160
14099
|
}
|
|
14161
14100
|
return heading2 || rootNode;
|
|
14162
14101
|
}
|
|
14163
|
-
function
|
|
14164
|
-
|
|
14102
|
+
function getContent($node) {
|
|
14103
|
+
var _a2;
|
|
14104
|
+
const result = extractMagicComments($node);
|
|
14105
|
+
const html22 = (_a2 = $2.html(result.$node)) == null ? void 0 : _a2.trimEnd();
|
|
14106
|
+
return { comments: result.comments, html: html22 };
|
|
14107
|
+
}
|
|
14108
|
+
function extractMagicComments($node) {
|
|
14109
|
+
const comments = [];
|
|
14110
|
+
$node = $node.filter((_, child) => {
|
|
14111
|
+
if (child.type === "comment") {
|
|
14112
|
+
const data2 = child.data.trim();
|
|
14113
|
+
if (data2.startsWith(MARKMAP_COMMENT_PREFIX)) {
|
|
14114
|
+
comments.push(data2.slice(MARKMAP_COMMENT_PREFIX.length).trim());
|
|
14115
|
+
return false;
|
|
14116
|
+
}
|
|
14117
|
+
}
|
|
14118
|
+
return true;
|
|
14119
|
+
});
|
|
14120
|
+
return { $node, comments };
|
|
14121
|
+
}
|
|
14122
|
+
function checkNodes($els, node) {
|
|
14123
|
+
$els.each((_, child) => {
|
|
14124
|
+
var _a2;
|
|
14165
14125
|
const $child = $2(child);
|
|
14166
|
-
|
|
14167
|
-
|
|
14126
|
+
const rule = (_a2 = Object.entries(options.selectorRules).find(
|
|
14127
|
+
([selector]) => $child.is(selector)
|
|
14128
|
+
)) == null ? void 0 : _a2[1];
|
|
14129
|
+
const result = rule == null ? void 0 : rule({ $node: $child, $: $2, getContent });
|
|
14130
|
+
if ((result == null ? void 0 : result.queue) && !result.nesting) {
|
|
14131
|
+
checkNodes(result.queue, node);
|
|
14168
14132
|
return;
|
|
14169
14133
|
}
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
if (
|
|
14173
|
-
skippingHeading =
|
|
14134
|
+
const level = getLevel(child.tagName);
|
|
14135
|
+
if (!result) {
|
|
14136
|
+
if (level <= 6) {
|
|
14137
|
+
skippingHeading = level;
|
|
14174
14138
|
}
|
|
14175
14139
|
return;
|
|
14176
14140
|
}
|
|
14177
|
-
|
|
14178
|
-
if (skippingHeading > 0 && level > skippingHeading) {
|
|
14141
|
+
if (skippingHeading > 0 && level > skippingHeading)
|
|
14179
14142
|
return;
|
|
14180
|
-
|
|
14181
|
-
skippingHeading = 0;
|
|
14182
|
-
if ($child.is(options.selectorNesting)) {
|
|
14183
|
-
const childNode2 = addChild(
|
|
14184
|
-
$child,
|
|
14185
|
-
node || getCurrentHeading(level),
|
|
14186
|
-
true
|
|
14187
|
-
);
|
|
14188
|
-
if (childNode2) {
|
|
14189
|
-
checkNode($child, childNode2);
|
|
14190
|
-
$child.remove();
|
|
14191
|
-
}
|
|
14143
|
+
if (!$child.is(options.selector))
|
|
14192
14144
|
return;
|
|
14193
|
-
|
|
14145
|
+
skippingHeading = 0;
|
|
14194
14146
|
const isHeading = level <= 6;
|
|
14195
|
-
const childNode = addChild(
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14147
|
+
const childNode = addChild({
|
|
14148
|
+
parent: node || getCurrentHeading(level),
|
|
14149
|
+
nesting: !!result.queue || isHeading,
|
|
14150
|
+
tagName: child.tagName,
|
|
14151
|
+
level,
|
|
14152
|
+
html: result.html || "",
|
|
14153
|
+
comments: result.comments,
|
|
14154
|
+
data: $child.data()
|
|
14155
|
+
});
|
|
14200
14156
|
if (isHeading)
|
|
14201
14157
|
headingStack.push(childNode);
|
|
14158
|
+
if (result.queue)
|
|
14159
|
+
checkNodes(result.queue, childNode);
|
|
14202
14160
|
});
|
|
14203
14161
|
}
|
|
14204
14162
|
}
|
|
@@ -18047,7 +18005,13 @@
|
|
|
18047
18005
|
function definePlugin(plugin2) {
|
|
18048
18006
|
return plugin2;
|
|
18049
18007
|
}
|
|
18008
|
+
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';
|
|
18009
|
+
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';
|
|
18050
18010
|
const name$5 = "checkbox";
|
|
18011
|
+
const images = {
|
|
18012
|
+
" ": svgUnmarked.trim(),
|
|
18013
|
+
x: svgMarked.trim()
|
|
18014
|
+
};
|
|
18051
18015
|
const plugin$3 = definePlugin({
|
|
18052
18016
|
name: name$5,
|
|
18053
18017
|
transform(transformHooks) {
|
|
@@ -18062,11 +18026,10 @@
|
|
|
18062
18026
|
const prevType = state.tokens[i2 - 1].type;
|
|
18063
18027
|
const prevPrevType = state.tokens[i2 - 2].type;
|
|
18064
18028
|
if (prevType === "heading_open" || prevType === "paragraph_open" && prevPrevType === "list_item_open") {
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
}
|
|
18029
|
+
token.content = token.content.replace(
|
|
18030
|
+
/^\[(.)\] /,
|
|
18031
|
+
(m, g) => images[g] ? `${images[g]} ` : m
|
|
18032
|
+
);
|
|
18070
18033
|
}
|
|
18071
18034
|
}
|
|
18072
18035
|
}
|
|
@@ -18078,6 +18041,7 @@
|
|
|
18078
18041
|
return {};
|
|
18079
18042
|
}
|
|
18080
18043
|
});
|
|
18044
|
+
const pluginCheckbox = plugin$3;
|
|
18081
18045
|
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
|
|
18082
18046
|
function isNothing(subject) {
|
|
18083
18047
|
return typeof subject === "undefined" || subject === null;
|
|
@@ -20766,8 +20730,9 @@
|
|
|
20766
20730
|
safeLoadAll,
|
|
20767
20731
|
safeDump
|
|
20768
20732
|
};
|
|
20733
|
+
const yaml = jsYaml;
|
|
20769
20734
|
const name$4 = "frontmatter";
|
|
20770
|
-
const
|
|
20735
|
+
const pluginFrontmatter = definePlugin({
|
|
20771
20736
|
name: name$4,
|
|
20772
20737
|
transform(transformHooks) {
|
|
20773
20738
|
transformHooks.beforeParse.tap((md, context) => {
|
|
@@ -20778,18 +20743,18 @@
|
|
|
20778
20743
|
if (!match)
|
|
20779
20744
|
return;
|
|
20780
20745
|
const raw = content.slice(4, match.index);
|
|
20781
|
-
let
|
|
20746
|
+
let frontmatter;
|
|
20782
20747
|
try {
|
|
20783
|
-
|
|
20784
|
-
if (
|
|
20785
|
-
|
|
20786
|
-
|
|
20748
|
+
frontmatter = yaml.load(raw);
|
|
20749
|
+
if (frontmatter == null ? void 0 : frontmatter.markmap) {
|
|
20750
|
+
frontmatter.markmap = normalizeMarkmapJsonOptions(
|
|
20751
|
+
frontmatter.markmap
|
|
20787
20752
|
);
|
|
20788
20753
|
}
|
|
20789
20754
|
} catch {
|
|
20790
20755
|
return;
|
|
20791
20756
|
}
|
|
20792
|
-
context.frontmatter =
|
|
20757
|
+
context.frontmatter = frontmatter;
|
|
20793
20758
|
context.content = content.slice(match.index + match[0].length);
|
|
20794
20759
|
context.contentLineOffset = content.slice(0, match.index).split("\n").length + 1;
|
|
20795
20760
|
});
|
|
@@ -20852,7 +20817,6 @@
|
|
|
20852
20817
|
].map((path) => buildJSItem(path));
|
|
20853
20818
|
const styles$1 = [
|
|
20854
20819
|
`@highlightjs/cdn-assets@${"11.8.0"}/styles/default.min.css`
|
|
20855
|
-
// `highlight.js@${process.env.HLJS_VERSION}/styles/default.css`,
|
|
20856
20820
|
].map((path) => buildCSSItem(path));
|
|
20857
20821
|
const config$1 = {
|
|
20858
20822
|
versions: {
|
|
@@ -20900,6 +20864,7 @@
|
|
|
20900
20864
|
};
|
|
20901
20865
|
}
|
|
20902
20866
|
});
|
|
20867
|
+
const pluginHljs = plugin$2;
|
|
20903
20868
|
const rkatex = (md, options) => {
|
|
20904
20869
|
const backslash = "\\";
|
|
20905
20870
|
const dollar = "$";
|
|
@@ -21162,13 +21127,14 @@
|
|
|
21162
21127
|
};
|
|
21163
21128
|
}
|
|
21164
21129
|
});
|
|
21130
|
+
const pluginKatex = plugin$1;
|
|
21165
21131
|
const name$1 = "npmUrl";
|
|
21166
|
-
const
|
|
21132
|
+
const pluginNpmUrl = definePlugin({
|
|
21167
21133
|
name: name$1,
|
|
21168
21134
|
transform(transformHooks) {
|
|
21169
21135
|
transformHooks.afterParse.tap((_, context) => {
|
|
21170
|
-
const { frontmatter
|
|
21171
|
-
const markmap =
|
|
21136
|
+
const { frontmatter } = context;
|
|
21137
|
+
const markmap = frontmatter == null ? void 0 : frontmatter.markmap;
|
|
21172
21138
|
if (markmap) {
|
|
21173
21139
|
["extraJs", "extraCss"].forEach((key) => {
|
|
21174
21140
|
const value = markmap[key];
|
|
@@ -21206,7 +21172,7 @@
|
|
|
21206
21172
|
return {};
|
|
21207
21173
|
}
|
|
21208
21174
|
});
|
|
21209
|
-
function patchRule(rule) {
|
|
21175
|
+
function patchRule(rule, _key) {
|
|
21210
21176
|
return wrapFunction(rule, (render2, tokens, idx, ...rest) => {
|
|
21211
21177
|
let html2 = render2(tokens, idx, ...rest);
|
|
21212
21178
|
const { lines } = tokens[idx];
|
|
@@ -21219,14 +21185,16 @@
|
|
|
21219
21185
|
return html2;
|
|
21220
21186
|
});
|
|
21221
21187
|
}
|
|
21188
|
+
const pluginSourceLines = plugin;
|
|
21222
21189
|
const plugins = [
|
|
21223
|
-
|
|
21224
|
-
|
|
21225
|
-
|
|
21226
|
-
|
|
21227
|
-
|
|
21228
|
-
|
|
21190
|
+
pluginFrontmatter,
|
|
21191
|
+
pluginKatex,
|
|
21192
|
+
pluginHljs,
|
|
21193
|
+
pluginNpmUrl,
|
|
21194
|
+
pluginCheckbox,
|
|
21195
|
+
pluginSourceLines
|
|
21229
21196
|
];
|
|
21197
|
+
const builtInPlugins = plugins;
|
|
21230
21198
|
function cleanNode(node) {
|
|
21231
21199
|
while (!node.content && node.children.length === 1) {
|
|
21232
21200
|
node = node.children[0];
|
|
@@ -21243,11 +21211,11 @@
|
|
|
21243
21211
|
};
|
|
21244
21212
|
}
|
|
21245
21213
|
class Transformer {
|
|
21246
|
-
constructor(
|
|
21214
|
+
constructor(plugins2 = builtInPlugins) {
|
|
21247
21215
|
this.assetsMap = {};
|
|
21248
21216
|
this.urlBuilder = new UrlBuilder();
|
|
21249
21217
|
this.hooks = createTransformHooks(this);
|
|
21250
|
-
this.plugins =
|
|
21218
|
+
this.plugins = plugins2.map(
|
|
21251
21219
|
(plugin2) => typeof plugin2 === "function" ? plugin2() : plugin2
|
|
21252
21220
|
);
|
|
21253
21221
|
const assetsMap = {};
|
|
@@ -21316,58 +21284,12 @@
|
|
|
21316
21284
|
const keys = this.plugins.map((plugin2) => plugin2.name).filter((name2) => features[name2]);
|
|
21317
21285
|
return this.getAssets(keys);
|
|
21318
21286
|
}
|
|
21319
|
-
fillTemplate(root2, assets, extra) {
|
|
21320
|
-
extra = {
|
|
21321
|
-
...extra
|
|
21322
|
-
};
|
|
21323
|
-
extra.baseJs ?? (extra.baseJs = baseJsPaths.map((path) => this.urlBuilder.getFullUrl(path)).map((path) => buildJSItem(path)));
|
|
21324
|
-
const { scripts, styles: styles2 } = assets;
|
|
21325
|
-
const cssList = [...styles2 ? persistCSS(styles2) : []];
|
|
21326
|
-
const context = {
|
|
21327
|
-
getMarkmap: () => window.markmap,
|
|
21328
|
-
getOptions: extra.getOptions,
|
|
21329
|
-
jsonOptions: extra.jsonOptions,
|
|
21330
|
-
root: root2
|
|
21331
|
-
};
|
|
21332
|
-
const jsList = [
|
|
21333
|
-
...persistJS(
|
|
21334
|
-
[
|
|
21335
|
-
...extra.baseJs,
|
|
21336
|
-
...scripts || [],
|
|
21337
|
-
{
|
|
21338
|
-
type: "iife",
|
|
21339
|
-
data: {
|
|
21340
|
-
fn: (getMarkmap, getOptions, root22, jsonOptions) => {
|
|
21341
|
-
const markmap = getMarkmap();
|
|
21342
|
-
window.mm = markmap.Markmap.create(
|
|
21343
|
-
"svg#mindmap",
|
|
21344
|
-
(getOptions || markmap.deriveOptions)(jsonOptions),
|
|
21345
|
-
root22
|
|
21346
|
-
);
|
|
21347
|
-
},
|
|
21348
|
-
getParams: ({ getMarkmap, getOptions, root: root22, jsonOptions }) => {
|
|
21349
|
-
return [getMarkmap, getOptions, root22, jsonOptions];
|
|
21350
|
-
}
|
|
21351
|
-
}
|
|
21352
|
-
}
|
|
21353
|
-
],
|
|
21354
|
-
context
|
|
21355
|
-
)
|
|
21356
|
-
];
|
|
21357
|
-
const html2 = template.replace("<!--CSS-->", () => cssList.join("")).replace("<!--JS-->", () => jsList.join(""));
|
|
21358
|
-
return html2;
|
|
21359
|
-
}
|
|
21360
21287
|
}
|
|
21361
21288
|
const transformerVersions = {
|
|
21362
|
-
"markmap-lib": "
|
|
21363
|
-
d3: "7.8.5"
|
|
21289
|
+
"markmap-lib": "0.16.1"
|
|
21364
21290
|
};
|
|
21365
21291
|
exports.Transformer = Transformer;
|
|
21366
|
-
exports.
|
|
21367
|
-
exports.builtInPlugins = plugins;
|
|
21368
|
-
exports.svg_marked = svg_marked;
|
|
21369
|
-
exports.svg_unmarked = svg_unmarked;
|
|
21370
|
-
exports.template = template;
|
|
21292
|
+
exports.builtInPlugins = builtInPlugins;
|
|
21371
21293
|
exports.transformerVersions = transformerVersions;
|
|
21372
21294
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
21373
21295
|
})(this.markmap = this.markmap || {}, window.katex);
|