markmap-lib 0.14.5-alpha.19 → 0.14.5-alpha.22
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.js +206 -587
- package/dist/browser/index.mjs +225 -10987
- package/dist/index.js +158 -158
- package/dist/index.mjs +158 -158
- package/package.json +5 -4
- package/types/constants.d.ts +2 -0
- package/types/index.d.ts +1 -1
- package/types/plugins/base.d.ts +3 -3
- package/types/plugins/frontmatter.d.ts +1 -1
- package/types/plugins/hljs.d.ts +2 -0
- package/types/plugins/index.d.ts +1 -1
- package/types/plugins/katex.browser.d.ts +2 -2
- package/types/plugins/katex.config.d.ts +2 -1
- package/types/plugins/katex.d.ts +2 -2
- package/types/plugins/npm-url.d.ts +1 -1
- package/types/plugins/prism.browser.d.ts +2 -2
- package/types/plugins/prism.config.d.ts +2 -1
- package/types/plugins/prism.d.ts +2 -2
- package/types/plugins/util.d.ts +4 -0
- package/types/transform.d.ts +9 -3
- package/types/types.d.ts +5 -1
- package/types/template.d.ts +0 -8
package/dist/browser/index.js
CHANGED
|
@@ -1,47 +1,13 @@
|
|
|
1
|
-
/*! markmap-lib v0.14.5-alpha.
|
|
1
|
+
/*! markmap-lib v0.14.5-alpha.22+04afb38 | MIT License */
|
|
2
2
|
(function (global, factory) {
|
|
3
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('katex')) :
|
|
4
|
-
typeof define === 'function' && define.amd ? define(['exports', 'katex'], factory) :
|
|
5
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.markmap = global.markmap || {}, global.window.katex));
|
|
6
|
-
})(this, (function (exports, require$$0) { 'use strict';
|
|
3
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('markmap-common'), require('katex'), require('highlight.js')) :
|
|
4
|
+
typeof define === 'function' && define.amd ? define(['exports', 'markmap-common', 'katex', 'highlight.js'], factory) :
|
|
5
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.markmap = global.markmap || {}, global.markmap, global.window.katex, global.window.hljs));
|
|
6
|
+
})(this, (function (exports, markmapCommon, require$$0, hljs) { 'use strict';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
11
|
-
var source = arguments[i];
|
|
12
|
-
for (var key in source) {
|
|
13
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
14
|
-
target[key] = source[key];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
return _extends$1.apply(this, arguments);
|
|
21
|
-
}
|
|
8
|
+
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" ;
|
|
9
|
+
const baseJsPaths = [`d3@${"7.8.5"}/dist/d3.min.js`, `markmap-view@${"0.14.5-alpha.22"}/dist/browser/index.js`];
|
|
22
10
|
|
|
23
|
-
/*! markmap-common v0.14.5-alpha.19+5323905 | MIT License */
|
|
24
|
-
class Hook {
|
|
25
|
-
constructor() {
|
|
26
|
-
this.listeners = [];
|
|
27
|
-
}
|
|
28
|
-
tap(fn) {
|
|
29
|
-
this.listeners.push(fn);
|
|
30
|
-
return () => this.revoke(fn);
|
|
31
|
-
}
|
|
32
|
-
revoke(fn) {
|
|
33
|
-
const i = this.listeners.indexOf(fn);
|
|
34
|
-
if (i >= 0) this.listeners.splice(i, 1);
|
|
35
|
-
}
|
|
36
|
-
revokeAll() {
|
|
37
|
-
this.listeners.splice(0);
|
|
38
|
-
}
|
|
39
|
-
call(...args) {
|
|
40
|
-
for (const fn of this.listeners) {
|
|
41
|
-
fn(...args);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
11
|
function _extends() {
|
|
46
12
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
47
13
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -56,377 +22,6 @@ function _extends() {
|
|
|
56
22
|
};
|
|
57
23
|
return _extends.apply(this, arguments);
|
|
58
24
|
}
|
|
59
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
60
|
-
if (source == null) return {};
|
|
61
|
-
var target = {};
|
|
62
|
-
var sourceKeys = Object.keys(source);
|
|
63
|
-
var key, i;
|
|
64
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
65
|
-
key = sourceKeys[i];
|
|
66
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
67
|
-
target[key] = source[key];
|
|
68
|
-
}
|
|
69
|
-
return target;
|
|
70
|
-
}
|
|
71
|
-
const _excluded = ["textContent"];
|
|
72
|
-
const escapeChars = {
|
|
73
|
-
'&': '&',
|
|
74
|
-
'<': '<',
|
|
75
|
-
'"': '"'
|
|
76
|
-
};
|
|
77
|
-
function escapeHtml$1(html) {
|
|
78
|
-
return html.replace(/[&<"]/g, m => escapeChars[m]);
|
|
79
|
-
}
|
|
80
|
-
function escapeScript(content) {
|
|
81
|
-
return content.replace(/<(\/script>)/g, '\\x3c$2');
|
|
82
|
-
}
|
|
83
|
-
function htmlOpen(tagName, attrs) {
|
|
84
|
-
const attrStr = attrs ? Object.entries(attrs).map(([key, value]) => {
|
|
85
|
-
if (value == null || value === false) return;
|
|
86
|
-
key = ` ${escapeHtml$1(key)}`;
|
|
87
|
-
if (value === true) return key;
|
|
88
|
-
return `${key}="${escapeHtml$1(value)}"`;
|
|
89
|
-
}).filter(Boolean).join('') : '';
|
|
90
|
-
return `<${tagName}${attrStr}>`;
|
|
91
|
-
}
|
|
92
|
-
function htmlClose(tagName) {
|
|
93
|
-
return `</${tagName}>`;
|
|
94
|
-
}
|
|
95
|
-
function wrapHtml(tagName, content, attrs) {
|
|
96
|
-
if (content == null) return htmlOpen(tagName, attrs);
|
|
97
|
-
return htmlOpen(tagName, attrs) + (content || '') + htmlClose(tagName);
|
|
98
|
-
}
|
|
99
|
-
function buildCode(fn, args) {
|
|
100
|
-
const params = args.map(arg => {
|
|
101
|
-
if (typeof arg === 'function') return arg.toString();
|
|
102
|
-
return JSON.stringify(arg != null ? arg : null);
|
|
103
|
-
}).join(',');
|
|
104
|
-
return `(${fn.toString()})(${params})`;
|
|
105
|
-
}
|
|
106
|
-
function persistJS(items, context) {
|
|
107
|
-
return items.map(item => {
|
|
108
|
-
if (item.type === 'script') {
|
|
109
|
-
const _item$data = item.data,
|
|
110
|
-
{
|
|
111
|
-
textContent
|
|
112
|
-
} = _item$data,
|
|
113
|
-
rest = _objectWithoutPropertiesLoose(_item$data, _excluded);
|
|
114
|
-
return wrapHtml('script', textContent || '', rest);
|
|
115
|
-
}
|
|
116
|
-
if (item.type === 'iife') {
|
|
117
|
-
const {
|
|
118
|
-
fn,
|
|
119
|
-
getParams
|
|
120
|
-
} = item.data;
|
|
121
|
-
return wrapHtml('script', escapeScript(buildCode(fn, (getParams == null ? void 0 : getParams(context)) || [])));
|
|
122
|
-
}
|
|
123
|
-
return '';
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function persistCSS(items) {
|
|
127
|
-
return items.map(item => {
|
|
128
|
-
if (item.type === 'stylesheet') {
|
|
129
|
-
return wrapHtml('link', null, _extends({
|
|
130
|
-
rel: 'stylesheet'
|
|
131
|
-
}, item.data));
|
|
132
|
-
}
|
|
133
|
-
/* else if (item.type === 'style') */
|
|
134
|
-
return wrapHtml('style', item.data);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
Math.random().toString(36).slice(2, 8);
|
|
138
|
-
function noop() {
|
|
139
|
-
// noop
|
|
140
|
-
}
|
|
141
|
-
function wrapFunction(fn, wrapper) {
|
|
142
|
-
return (...args) => wrapper(fn, ...args);
|
|
143
|
-
}
|
|
144
|
-
function memoize(fn) {
|
|
145
|
-
const cache = {};
|
|
146
|
-
return function memoized(...args) {
|
|
147
|
-
const key = `${args[0]}`;
|
|
148
|
-
let data = cache[key];
|
|
149
|
-
if (!data) {
|
|
150
|
-
data = {
|
|
151
|
-
value: fn(...args)
|
|
152
|
-
};
|
|
153
|
-
cache[key] = data;
|
|
154
|
-
}
|
|
155
|
-
return data.value;
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/*! @gera2ld/jsx-dom v2.2.2 | ISC License */
|
|
160
|
-
const VTYPE_ELEMENT = 1;
|
|
161
|
-
const VTYPE_FUNCTION = 2;
|
|
162
|
-
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
163
|
-
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
164
|
-
const NS_ATTRS = {
|
|
165
|
-
show: XLINK_NS,
|
|
166
|
-
actuate: XLINK_NS,
|
|
167
|
-
href: XLINK_NS
|
|
168
|
-
};
|
|
169
|
-
const isLeaf = c => typeof c === 'string' || typeof c === 'number';
|
|
170
|
-
const isElement = c => (c == null ? void 0 : c.vtype) === VTYPE_ELEMENT;
|
|
171
|
-
const isRenderFunction = c => (c == null ? void 0 : c.vtype) === VTYPE_FUNCTION;
|
|
172
|
-
function h(type, props, ...children) {
|
|
173
|
-
props = Object.assign({}, props, {
|
|
174
|
-
children: children.length === 1 ? children[0] : children
|
|
175
|
-
});
|
|
176
|
-
return jsx(type, props);
|
|
177
|
-
}
|
|
178
|
-
function jsx(type, props) {
|
|
179
|
-
let vtype;
|
|
180
|
-
if (typeof type === 'string') vtype = VTYPE_ELEMENT;else if (typeof type === 'function') vtype = VTYPE_FUNCTION;else throw new Error('Invalid VNode type');
|
|
181
|
-
return {
|
|
182
|
-
vtype,
|
|
183
|
-
type,
|
|
184
|
-
props
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
function Fragment(props) {
|
|
188
|
-
return props.children;
|
|
189
|
-
}
|
|
190
|
-
const DEFAULT_ENV = {
|
|
191
|
-
isSvg: false
|
|
192
|
-
};
|
|
193
|
-
function insertDom(parent, nodes) {
|
|
194
|
-
if (!Array.isArray(nodes)) nodes = [nodes];
|
|
195
|
-
nodes = nodes.filter(Boolean);
|
|
196
|
-
if (nodes.length) parent.append(...nodes);
|
|
197
|
-
}
|
|
198
|
-
function mountAttributes(domElement, props, env) {
|
|
199
|
-
for (const key in props) {
|
|
200
|
-
if (key === 'key' || key === 'children' || key === 'ref') continue;
|
|
201
|
-
if (key === 'dangerouslySetInnerHTML') {
|
|
202
|
-
domElement.innerHTML = props[key].__html;
|
|
203
|
-
} else if (key === 'innerHTML' || key === 'textContent' || key === 'innerText' || key === 'value' && ['textarea', 'select'].includes(domElement.tagName)) {
|
|
204
|
-
const value = props[key];
|
|
205
|
-
if (value != null) domElement[key] = value;
|
|
206
|
-
} else if (key.startsWith('on')) {
|
|
207
|
-
domElement[key.toLowerCase()] = props[key];
|
|
208
|
-
} else {
|
|
209
|
-
setDOMAttribute(domElement, key, props[key], env.isSvg);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
const attrMap = {
|
|
214
|
-
className: 'class',
|
|
215
|
-
labelFor: 'for'
|
|
216
|
-
};
|
|
217
|
-
function setDOMAttribute(el, attr, value, isSVG) {
|
|
218
|
-
attr = attrMap[attr] || attr;
|
|
219
|
-
if (value === true) {
|
|
220
|
-
el.setAttribute(attr, '');
|
|
221
|
-
} else if (value === false) {
|
|
222
|
-
el.removeAttribute(attr);
|
|
223
|
-
} else {
|
|
224
|
-
const namespace = isSVG ? NS_ATTRS[attr] : undefined;
|
|
225
|
-
if (namespace !== undefined) {
|
|
226
|
-
el.setAttributeNS(namespace, attr, value);
|
|
227
|
-
} else {
|
|
228
|
-
el.setAttribute(attr, value);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
function flatten(arr) {
|
|
233
|
-
return arr.reduce((prev, item) => prev.concat(item), []);
|
|
234
|
-
}
|
|
235
|
-
function mountChildren(children, env) {
|
|
236
|
-
return Array.isArray(children) ? flatten(children.map(child => mountChildren(child, env))) : mount(children, env);
|
|
237
|
-
}
|
|
238
|
-
function mount(vnode, env = DEFAULT_ENV) {
|
|
239
|
-
if (vnode == null || typeof vnode === 'boolean') {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
if (vnode instanceof Node) {
|
|
243
|
-
return vnode;
|
|
244
|
-
}
|
|
245
|
-
if (isRenderFunction(vnode)) {
|
|
246
|
-
const {
|
|
247
|
-
type,
|
|
248
|
-
props
|
|
249
|
-
} = vnode;
|
|
250
|
-
if (type === Fragment) {
|
|
251
|
-
const node = document.createDocumentFragment();
|
|
252
|
-
if (props.children) {
|
|
253
|
-
const children = mountChildren(props.children, env);
|
|
254
|
-
insertDom(node, children);
|
|
255
|
-
}
|
|
256
|
-
return node;
|
|
257
|
-
}
|
|
258
|
-
const childVNode = type(props);
|
|
259
|
-
return mount(childVNode, env);
|
|
260
|
-
}
|
|
261
|
-
if (isLeaf(vnode)) {
|
|
262
|
-
return document.createTextNode(`${vnode}`);
|
|
263
|
-
}
|
|
264
|
-
if (isElement(vnode)) {
|
|
265
|
-
let node;
|
|
266
|
-
const {
|
|
267
|
-
type,
|
|
268
|
-
props
|
|
269
|
-
} = vnode;
|
|
270
|
-
if (!env.isSvg && type === 'svg') {
|
|
271
|
-
env = Object.assign({}, env, {
|
|
272
|
-
isSvg: true
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
if (!env.isSvg) {
|
|
276
|
-
node = document.createElement(type);
|
|
277
|
-
} else {
|
|
278
|
-
node = document.createElementNS(SVG_NS, type);
|
|
279
|
-
}
|
|
280
|
-
mountAttributes(node, props, env);
|
|
281
|
-
if (props.children) {
|
|
282
|
-
let childEnv = env;
|
|
283
|
-
if (env.isSvg && type === 'foreignObject') {
|
|
284
|
-
childEnv = Object.assign({}, childEnv, {
|
|
285
|
-
isSvg: false
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
const children = mountChildren(props.children, childEnv);
|
|
289
|
-
if (children != null) insertDom(node, children);
|
|
290
|
-
}
|
|
291
|
-
const {
|
|
292
|
-
ref
|
|
293
|
-
} = props;
|
|
294
|
-
if (typeof ref === 'function') ref(node);
|
|
295
|
-
return node;
|
|
296
|
-
}
|
|
297
|
-
throw new Error('mount: Invalid Vnode!');
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Mount vdom as real DOM nodes.
|
|
302
|
-
*/
|
|
303
|
-
function mountDom(vnode) {
|
|
304
|
-
return mount(vnode);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Render and mount without returning VirtualDOM, useful when you don't need SVG support.
|
|
309
|
-
*/
|
|
310
|
-
function hm(...args) {
|
|
311
|
-
return mountDom(h(...args));
|
|
312
|
-
}
|
|
313
|
-
const providers = {
|
|
314
|
-
jsdelivr: path => `https://cdn.jsdelivr.net/npm/${path}`,
|
|
315
|
-
unpkg: path => `https://unpkg.com/${path}`
|
|
316
|
-
};
|
|
317
|
-
function cdnUrl(provider, path) {
|
|
318
|
-
const factory = providers[provider];
|
|
319
|
-
if (!factory) {
|
|
320
|
-
throw new Error(`Provider ${provider} not found`);
|
|
321
|
-
}
|
|
322
|
-
return factory(path);
|
|
323
|
-
}
|
|
324
|
-
const memoizedPreloadJS = memoize(url => {
|
|
325
|
-
document.head.append(hm('link', {
|
|
326
|
-
rel: 'preload',
|
|
327
|
-
as: 'script',
|
|
328
|
-
href: url
|
|
329
|
-
}));
|
|
330
|
-
});
|
|
331
|
-
async function loadJSItem(item, context) {
|
|
332
|
-
if (!item.loaded) {
|
|
333
|
-
if (item.type === 'script') {
|
|
334
|
-
item.loaded = new Promise((resolve, reject) => {
|
|
335
|
-
var _item$data;
|
|
336
|
-
document.head.append(hm('script', _extends({}, item.data, {
|
|
337
|
-
onLoad: resolve,
|
|
338
|
-
onError: reject
|
|
339
|
-
})));
|
|
340
|
-
// Run inline script synchronously
|
|
341
|
-
if (!((_item$data = item.data) != null && _item$data.src)) resolve(undefined);
|
|
342
|
-
}).then(() => {
|
|
343
|
-
item.loaded = true;
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
if (item.type === 'iife') {
|
|
347
|
-
const {
|
|
348
|
-
fn,
|
|
349
|
-
getParams
|
|
350
|
-
} = item.data;
|
|
351
|
-
fn(...((getParams == null ? void 0 : getParams(context)) || []));
|
|
352
|
-
item.loaded = true;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
await item.loaded;
|
|
356
|
-
}
|
|
357
|
-
async function loadJS(items, context) {
|
|
358
|
-
items.forEach(item => {
|
|
359
|
-
var _item$data2;
|
|
360
|
-
if (item.type === 'script' && (_item$data2 = item.data) != null && _item$data2.src) {
|
|
361
|
-
memoizedPreloadJS(item.data.src);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
context = _extends({
|
|
365
|
-
getMarkmap: () => window.markmap
|
|
366
|
-
}, context);
|
|
367
|
-
for (const item of items) {
|
|
368
|
-
await loadJSItem(item, context);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
let provider = 'jsdelivr';
|
|
372
|
-
function getFullUrl(path, overrideProvider = provider) {
|
|
373
|
-
if (path.includes('://')) return path;
|
|
374
|
-
return cdnUrl(overrideProvider, path);
|
|
375
|
-
}
|
|
376
|
-
function buildJSItem(path, overrideProvider) {
|
|
377
|
-
return {
|
|
378
|
-
type: 'script',
|
|
379
|
-
data: {
|
|
380
|
-
src: getFullUrl(path, overrideProvider)
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
function buildCSSItem(path, overrideProvider) {
|
|
385
|
-
return {
|
|
386
|
-
type: 'stylesheet',
|
|
387
|
-
data: {
|
|
388
|
-
href: getFullUrl(path, overrideProvider)
|
|
389
|
-
}
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
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" ;
|
|
394
|
-
const baseJsPaths = [`d3@${"7.8.5"}/dist/d3.min.js`, `markmap-view@${"0.14.5-alpha.19"}/dist/browser/index.js`];
|
|
395
|
-
function fillTemplate(root, assets, extra) {
|
|
396
|
-
var _extra, _extra$baseJs;
|
|
397
|
-
extra = _extends$1({}, extra);
|
|
398
|
-
(_extra$baseJs = (_extra = extra).baseJs) != null ? _extra$baseJs : _extra.baseJs = baseJsPaths.map(path => buildJSItem(path));
|
|
399
|
-
const {
|
|
400
|
-
scripts,
|
|
401
|
-
styles
|
|
402
|
-
} = assets;
|
|
403
|
-
const cssList = [...(styles ? persistCSS(styles) : [])];
|
|
404
|
-
const context = {
|
|
405
|
-
getMarkmap: () => window.markmap,
|
|
406
|
-
getOptions: extra.getOptions,
|
|
407
|
-
jsonOptions: extra.jsonOptions,
|
|
408
|
-
root
|
|
409
|
-
};
|
|
410
|
-
const jsList = [...persistJS([...extra.baseJs, ...(scripts || []), {
|
|
411
|
-
type: 'iife',
|
|
412
|
-
data: {
|
|
413
|
-
fn: (getMarkmap, getOptions, root, jsonOptions) => {
|
|
414
|
-
const markmap = getMarkmap();
|
|
415
|
-
window.mm = markmap.Markmap.create('svg#mindmap', (getOptions || markmap.deriveOptions)(jsonOptions), root);
|
|
416
|
-
},
|
|
417
|
-
getParams: ({
|
|
418
|
-
getMarkmap,
|
|
419
|
-
getOptions,
|
|
420
|
-
root,
|
|
421
|
-
jsonOptions
|
|
422
|
-
}) => {
|
|
423
|
-
return [getMarkmap, getOptions, root, jsonOptions];
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
}], context)];
|
|
427
|
-
const html = template.replace('<!--CSS-->', () => cssList.join('')).replace('<!--JS-->', () => jsList.join(''));
|
|
428
|
-
return html;
|
|
429
|
-
}
|
|
430
25
|
|
|
431
26
|
// List of valid entities
|
|
432
27
|
//
|
|
@@ -7356,7 +6951,7 @@ var commonmarkConfig = {
|
|
|
7356
6951
|
* Preset configs
|
|
7357
6952
|
*/
|
|
7358
6953
|
|
|
7359
|
-
var config = {
|
|
6954
|
+
var config$2 = {
|
|
7360
6955
|
'default': defaultConfig,
|
|
7361
6956
|
'full': fullConfig,
|
|
7362
6957
|
'commonmark': commonmarkConfig
|
|
@@ -7404,7 +6999,7 @@ function Remarkable(preset, options) {
|
|
|
7404
6999
|
this.renderer = new Renderer();
|
|
7405
7000
|
this.ruler = new Ruler();
|
|
7406
7001
|
this.options = {};
|
|
7407
|
-
this.configure(config[preset]);
|
|
7002
|
+
this.configure(config$2[preset]);
|
|
7408
7003
|
this.set(options || {});
|
|
7409
7004
|
}
|
|
7410
7005
|
|
|
@@ -7688,40 +7283,39 @@ var remarkableKatex = rkatex;
|
|
|
7688
7283
|
|
|
7689
7284
|
var remarkableKatex$1 = /*@__PURE__*/getDefaultExportFromCjs(remarkableKatex);
|
|
7690
7285
|
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
}
|
|
7286
|
+
const name$3 = 'katex';
|
|
7287
|
+
const preloadScripts = [`katex@${"0.16.8"}/dist/katex.min.js`].map(path => markmapCommon.buildJSItem(path));
|
|
7288
|
+
const webfontloader = markmapCommon.buildJSItem(`webfontloader@${"1.6.28"}/webfontloader.js`);
|
|
7289
|
+
webfontloader.data.defer = true;
|
|
7290
|
+
const styles$1 = [`katex@${"0.16.8"}/dist/katex.min.css`].map(path => markmapCommon.buildCSSItem(path));
|
|
7291
|
+
const config$1 = {
|
|
7292
|
+
versions: {
|
|
7293
|
+
katex: "0.16.8" ,
|
|
7294
|
+
webfontloader: "1.6.28"
|
|
7295
|
+
},
|
|
7296
|
+
preloadScripts,
|
|
7297
|
+
scripts: [{
|
|
7298
|
+
type: 'iife',
|
|
7299
|
+
data: {
|
|
7300
|
+
fn: getMarkmap => {
|
|
7301
|
+
window.WebFontConfig = {
|
|
7302
|
+
custom: {
|
|
7303
|
+
families: ['KaTeX_AMS', 'KaTeX_Caligraphic:n4,n7', 'KaTeX_Fraktur:n4,n7', 'KaTeX_Main:n4,n7,i4,i7', 'KaTeX_Math:i4,i7', 'KaTeX_Script', 'KaTeX_SansSerif:n4,n7,i4', 'KaTeX_Size1', 'KaTeX_Size2', 'KaTeX_Size3', 'KaTeX_Size4', 'KaTeX_Typewriter']
|
|
7304
|
+
},
|
|
7305
|
+
active: () => {
|
|
7306
|
+
getMarkmap().refreshHook.call();
|
|
7307
|
+
}
|
|
7308
|
+
};
|
|
7309
|
+
},
|
|
7310
|
+
getParams({
|
|
7311
|
+
getMarkmap
|
|
7312
|
+
}) {
|
|
7313
|
+
return [getMarkmap];
|
|
7720
7314
|
}
|
|
7721
|
-
}
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
}
|
|
7315
|
+
}
|
|
7316
|
+
}, webfontloader],
|
|
7317
|
+
styles: styles$1
|
|
7318
|
+
};
|
|
7725
7319
|
|
|
7726
7320
|
/**
|
|
7727
7321
|
* Find NPM paths and resolve them to full URLs with the same package version as in this library.
|
|
@@ -7740,14 +7334,35 @@ function addDefaultVersions(paths, name, version) {
|
|
|
7740
7334
|
return path;
|
|
7741
7335
|
});
|
|
7742
7336
|
}
|
|
7337
|
+
function patchJSItem(transformer, item) {
|
|
7338
|
+
if (item.type === 'script' && item.data.src) {
|
|
7339
|
+
return _extends({}, item, {
|
|
7340
|
+
data: _extends({}, item.data, {
|
|
7341
|
+
src: transformer.urlBuilder.getFullUrl(item.data.src)
|
|
7342
|
+
})
|
|
7343
|
+
});
|
|
7344
|
+
}
|
|
7345
|
+
return item;
|
|
7346
|
+
}
|
|
7347
|
+
function patchCSSItem(transformer, item) {
|
|
7348
|
+
if (item.type === 'stylesheet' && item.data.href) {
|
|
7349
|
+
return _extends({}, item, {
|
|
7350
|
+
data: _extends({}, item.data, {
|
|
7351
|
+
href: transformer.urlBuilder.getFullUrl(item.data.href)
|
|
7352
|
+
})
|
|
7353
|
+
});
|
|
7354
|
+
}
|
|
7355
|
+
return item;
|
|
7356
|
+
}
|
|
7743
7357
|
|
|
7744
|
-
function createTransformHooks() {
|
|
7358
|
+
function createTransformHooks(transformer) {
|
|
7745
7359
|
return {
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7360
|
+
transformer,
|
|
7361
|
+
parser: new markmapCommon.Hook(),
|
|
7362
|
+
beforeParse: new markmapCommon.Hook(),
|
|
7363
|
+
afterParse: new markmapCommon.Hook(),
|
|
7364
|
+
htmltag: new markmapCommon.Hook(),
|
|
7365
|
+
retransform: new markmapCommon.Hook()
|
|
7751
7366
|
};
|
|
7752
7367
|
}
|
|
7753
7368
|
|
|
@@ -7758,126 +7373,64 @@ function definePlugin(plugin) {
|
|
|
7758
7373
|
return plugin;
|
|
7759
7374
|
}
|
|
7760
7375
|
|
|
7761
|
-
const
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
});
|
|
7781
|
-
}
|
|
7782
|
-
autoload().then(() => {
|
|
7783
|
-
transformHooks.retransform.call();
|
|
7376
|
+
const plugin$1 = definePlugin({
|
|
7377
|
+
name: name$3,
|
|
7378
|
+
config: config$1,
|
|
7379
|
+
transform(transformHooks) {
|
|
7380
|
+
var _plugin$config3, _plugin$config4;
|
|
7381
|
+
let loading;
|
|
7382
|
+
const autoload = () => {
|
|
7383
|
+
var _plugin$config;
|
|
7384
|
+
loading || (loading = markmapCommon.loadJS(((_plugin$config = plugin$1.config) == null ? void 0 : _plugin$config.preloadScripts) || []));
|
|
7385
|
+
return loading;
|
|
7386
|
+
};
|
|
7387
|
+
const renderKatex = (source, displayMode) => {
|
|
7388
|
+
const {
|
|
7389
|
+
katex
|
|
7390
|
+
} = window;
|
|
7391
|
+
if (katex) {
|
|
7392
|
+
return katex.renderToString(source, {
|
|
7393
|
+
displayMode,
|
|
7394
|
+
throwOnError: false
|
|
7784
7395
|
});
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
transformHooks.parser.tap(md => {
|
|
7789
|
-
md.use(remarkableKatex$1);
|
|
7790
|
-
md.renderer.rules.katex = (tokens, idx) => {
|
|
7791
|
-
enableFeature();
|
|
7792
|
-
const result = renderKatex(tokens[idx].content, !!tokens[idx].block);
|
|
7793
|
-
return result;
|
|
7794
|
-
};
|
|
7795
|
-
});
|
|
7796
|
-
transformHooks.beforeParse.tap((_, context) => {
|
|
7797
|
-
enableFeature = () => {
|
|
7798
|
-
context.features[name$3] = true;
|
|
7799
|
-
};
|
|
7800
|
-
});
|
|
7801
|
-
transformHooks.afterParse.tap((_, context) => {
|
|
7802
|
-
var _context$frontmatter;
|
|
7803
|
-
const markmap = (_context$frontmatter = context.frontmatter) == null ? void 0 : _context$frontmatter.markmap;
|
|
7804
|
-
if (markmap) {
|
|
7805
|
-
['extraJs', 'extraCss'].forEach(key => {
|
|
7806
|
-
const value = markmap[key];
|
|
7807
|
-
if (value) {
|
|
7808
|
-
markmap[key] = addDefaultVersions(value, name$3, plugin.config.versions.katex);
|
|
7809
|
-
}
|
|
7810
|
-
});
|
|
7811
|
-
}
|
|
7396
|
+
}
|
|
7397
|
+
autoload().then(() => {
|
|
7398
|
+
transformHooks.retransform.call();
|
|
7812
7399
|
});
|
|
7813
|
-
return
|
|
7814
|
-
|
|
7815
|
-
|
|
7400
|
+
return source;
|
|
7401
|
+
};
|
|
7402
|
+
let enableFeature = markmapCommon.noop;
|
|
7403
|
+
transformHooks.parser.tap(md => {
|
|
7404
|
+
md.use(remarkableKatex$1);
|
|
7405
|
+
md.renderer.rules.katex = (tokens, idx) => {
|
|
7406
|
+
enableFeature();
|
|
7407
|
+
const result = renderKatex(tokens[idx].content, !!tokens[idx].block);
|
|
7408
|
+
return result;
|
|
7816
7409
|
};
|
|
7817
|
-
}
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
function getConfig() {
|
|
7823
|
-
const preloadScripts = [`prismjs@${"1.29.0"}/components/prism-core.min.js`, `prismjs@${"1.29.0"}/plugins/autoloader/prism-autoloader.min.js`].map(path => buildJSItem(path));
|
|
7824
|
-
const styles = [`prismjs@${"1.29.0"}/themes/prism.css`].map(path => buildCSSItem(path));
|
|
7825
|
-
return {
|
|
7826
|
-
versions: {
|
|
7827
|
-
prismjs: "1.29.0"
|
|
7828
|
-
},
|
|
7829
|
-
preloadScripts,
|
|
7830
|
-
styles
|
|
7831
|
-
};
|
|
7832
|
-
}
|
|
7833
|
-
|
|
7834
|
-
const name$2 = 'prism';
|
|
7835
|
-
var prism = definePlugin(() => {
|
|
7836
|
-
const plugin = {
|
|
7837
|
-
name: name$2,
|
|
7838
|
-
config: getConfig(),
|
|
7839
|
-
transform(transformHooks) {
|
|
7840
|
-
let loading;
|
|
7841
|
-
const autoload = () => {
|
|
7842
|
-
loading || (loading = loadJS(plugin.config.preloadScripts));
|
|
7843
|
-
return loading;
|
|
7410
|
+
});
|
|
7411
|
+
transformHooks.beforeParse.tap((_, context) => {
|
|
7412
|
+
enableFeature = () => {
|
|
7413
|
+
context.features[name$3] = true;
|
|
7844
7414
|
};
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
highlight: (str, lang) => {
|
|
7856
|
-
var _Prism$languages;
|
|
7857
|
-
enableFeature();
|
|
7858
|
-
const {
|
|
7859
|
-
Prism
|
|
7860
|
-
} = window;
|
|
7861
|
-
const grammar = Prism == null || (_Prism$languages = Prism.languages) == null ? void 0 : _Prism$languages[lang];
|
|
7862
|
-
if (!grammar) {
|
|
7863
|
-
loadLanguageAndRefresh(lang, transformHooks);
|
|
7864
|
-
return '';
|
|
7865
|
-
}
|
|
7866
|
-
return Prism.highlight(str, grammar, lang);
|
|
7415
|
+
});
|
|
7416
|
+
transformHooks.afterParse.tap((_, context) => {
|
|
7417
|
+
var _context$frontmatter;
|
|
7418
|
+
const markmap = (_context$frontmatter = context.frontmatter) == null ? void 0 : _context$frontmatter.markmap;
|
|
7419
|
+
if (markmap) {
|
|
7420
|
+
['extraJs', 'extraCss'].forEach(key => {
|
|
7421
|
+
const value = markmap[key];
|
|
7422
|
+
if (value) {
|
|
7423
|
+
var _plugin$config2;
|
|
7424
|
+
markmap[key] = addDefaultVersions(value, name$3, ((_plugin$config2 = plugin$1.config) == null || (_plugin$config2 = _plugin$config2.versions) == null ? void 0 : _plugin$config2.katex) || '');
|
|
7867
7425
|
}
|
|
7868
7426
|
});
|
|
7869
|
-
}
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
styles: plugin.config.styles
|
|
7877
|
-
};
|
|
7878
|
-
}
|
|
7879
|
-
};
|
|
7880
|
-
return plugin;
|
|
7427
|
+
}
|
|
7428
|
+
});
|
|
7429
|
+
return {
|
|
7430
|
+
styles: (_plugin$config3 = plugin$1.config) == null ? void 0 : _plugin$config3.styles,
|
|
7431
|
+
scripts: (_plugin$config4 = plugin$1.config) == null ? void 0 : _plugin$config4.scripts
|
|
7432
|
+
};
|
|
7433
|
+
}
|
|
7881
7434
|
});
|
|
7882
7435
|
|
|
7883
7436
|
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
|
|
@@ -10991,9 +10544,9 @@ var jsYaml = {
|
|
|
10991
10544
|
safeDump: safeDump
|
|
10992
10545
|
};
|
|
10993
10546
|
|
|
10994
|
-
const name$
|
|
10547
|
+
const name$2 = 'frontmatter';
|
|
10995
10548
|
var frontmatter = definePlugin({
|
|
10996
|
-
name: name$
|
|
10549
|
+
name: name$2,
|
|
10997
10550
|
transform(transformHooks) {
|
|
10998
10551
|
transformHooks.beforeParse.tap((md, context) => {
|
|
10999
10552
|
const {
|
|
@@ -11041,9 +10594,9 @@ function normalizeNumber(value) {
|
|
|
11041
10594
|
return +value;
|
|
11042
10595
|
}
|
|
11043
10596
|
|
|
11044
|
-
const name = 'npmUrl';
|
|
10597
|
+
const name$1 = 'npmUrl';
|
|
11045
10598
|
var npmUrl = definePlugin({
|
|
11046
|
-
name,
|
|
10599
|
+
name: name$1,
|
|
11047
10600
|
transform(transformHooks) {
|
|
11048
10601
|
transformHooks.afterParse.tap((_, context) => {
|
|
11049
10602
|
const {
|
|
@@ -11056,7 +10609,7 @@ var npmUrl = definePlugin({
|
|
|
11056
10609
|
if (value) {
|
|
11057
10610
|
markmap[key] = value.map(path => {
|
|
11058
10611
|
if (path.startsWith('npm:')) {
|
|
11059
|
-
return getFullUrl(path.slice(4));
|
|
10612
|
+
return transformHooks.transformer.urlBuilder.getFullUrl(path.slice(4));
|
|
11060
10613
|
}
|
|
11061
10614
|
return path;
|
|
11062
10615
|
});
|
|
@@ -11068,7 +10621,40 @@ var npmUrl = definePlugin({
|
|
|
11068
10621
|
}
|
|
11069
10622
|
});
|
|
11070
10623
|
|
|
11071
|
-
const
|
|
10624
|
+
const name = 'hljs';
|
|
10625
|
+
const styles = [`highlight.js@${"11.8.0"}/styles/default.css`].map(path => markmapCommon.buildCSSItem(path));
|
|
10626
|
+
const config = {
|
|
10627
|
+
versions: {
|
|
10628
|
+
hljs: "11.8.0"
|
|
10629
|
+
},
|
|
10630
|
+
styles
|
|
10631
|
+
};
|
|
10632
|
+
const plugin = definePlugin({
|
|
10633
|
+
name,
|
|
10634
|
+
config,
|
|
10635
|
+
transform(transformHooks) {
|
|
10636
|
+
var _plugin$config;
|
|
10637
|
+
let enableFeature = markmapCommon.noop;
|
|
10638
|
+
transformHooks.parser.tap(md => {
|
|
10639
|
+
md.set({
|
|
10640
|
+
highlight: (str, language) => {
|
|
10641
|
+
enableFeature();
|
|
10642
|
+
return hljs.highlightAuto(str, language ? [language] : undefined).value;
|
|
10643
|
+
}
|
|
10644
|
+
});
|
|
10645
|
+
});
|
|
10646
|
+
transformHooks.beforeParse.tap((_, context) => {
|
|
10647
|
+
enableFeature = () => {
|
|
10648
|
+
context.features[name] = true;
|
|
10649
|
+
};
|
|
10650
|
+
});
|
|
10651
|
+
return {
|
|
10652
|
+
styles: (_plugin$config = plugin.config) == null ? void 0 : _plugin$config.styles
|
|
10653
|
+
};
|
|
10654
|
+
}
|
|
10655
|
+
});
|
|
10656
|
+
|
|
10657
|
+
const plugins = [frontmatter, plugin$1, plugin, npmUrl];
|
|
11072
10658
|
|
|
11073
10659
|
function cleanNode(node) {
|
|
11074
10660
|
if (node.type === 'heading') {
|
|
@@ -11081,7 +10667,7 @@ function cleanNode(node) {
|
|
|
11081
10667
|
if (['paragraph', 'fence'].includes(item.type)) {
|
|
11082
10668
|
if (!node.content) {
|
|
11083
10669
|
node.content = item.content;
|
|
11084
|
-
node.payload = _extends
|
|
10670
|
+
node.payload = _extends({}, node.payload, item.payload);
|
|
11085
10671
|
}
|
|
11086
10672
|
return false;
|
|
11087
10673
|
}
|
|
@@ -11095,7 +10681,7 @@ function cleanNode(node) {
|
|
|
11095
10681
|
let index = (_node$payload$startIn = (_node$payload2 = node.payload) == null ? void 0 : _node$payload2.startIndex) != null ? _node$payload$startIn : 1;
|
|
11096
10682
|
node.children.forEach(item => {
|
|
11097
10683
|
if (item.type === 'list_item') {
|
|
11098
|
-
item.payload = _extends
|
|
10684
|
+
item.payload = _extends({}, item.payload, {
|
|
11099
10685
|
index
|
|
11100
10686
|
});
|
|
11101
10687
|
index += 1;
|
|
@@ -11118,7 +10704,8 @@ function resetDepth(node, depth = 0) {
|
|
|
11118
10704
|
class Transformer {
|
|
11119
10705
|
constructor(plugins$1 = plugins) {
|
|
11120
10706
|
this.assetsMap = {};
|
|
11121
|
-
this.
|
|
10707
|
+
this.urlBuilder = new markmapCommon.UrlBuilder();
|
|
10708
|
+
this.hooks = createTransformHooks(this);
|
|
11122
10709
|
this.plugins = plugins$1.map(plugin => typeof plugin === 'function' ? plugin() : plugin);
|
|
11123
10710
|
const assetsMap = {};
|
|
11124
10711
|
for (const {
|
|
@@ -11133,7 +10720,7 @@ class Transformer {
|
|
|
11133
10720
|
breaks: true,
|
|
11134
10721
|
maxNesting: Infinity
|
|
11135
10722
|
});
|
|
11136
|
-
md.renderer.rules.htmltag = wrapFunction(md.renderer.rules.htmltag, (render, ...args) => {
|
|
10723
|
+
md.renderer.rules.htmltag = markmapCommon.wrapFunction(md.renderer.rules.htmltag, (render, ...args) => {
|
|
11137
10724
|
const result = render(...args);
|
|
11138
10725
|
this.hooks.htmltag.call({
|
|
11139
10726
|
args,
|
|
@@ -11203,7 +10790,7 @@ class Transformer {
|
|
|
11203
10790
|
const comment = (_ctx$result = ctx.result) == null ? void 0 : _ctx$result.match(/^<!--([\s\S]*?)-->$/);
|
|
11204
10791
|
const data = comment == null ? void 0 : comment[1].trim().split(' ');
|
|
11205
10792
|
if ((data == null ? void 0 : data[0]) === 'fold') {
|
|
11206
|
-
current.payload = _extends
|
|
10793
|
+
current.payload = _extends({}, current.payload, {
|
|
11207
10794
|
fold: ['all', 'recursively'].includes(data[1]) ? 2 : 1
|
|
11208
10795
|
});
|
|
11209
10796
|
ctx.result = '';
|
|
@@ -11213,10 +10800,7 @@ class Transformer {
|
|
|
11213
10800
|
revoke();
|
|
11214
10801
|
current.content = `${current.content || ''}${text}`;
|
|
11215
10802
|
} else if (token.type === 'fence') {
|
|
11216
|
-
|
|
11217
|
-
// Remarkable only adds className to `<code>` but not `<pre>`, copy it to make PrismJS style work.
|
|
11218
|
-
const matches = result.match(/<code( class="[^"]*")>/);
|
|
11219
|
-
if (matches) result = result.replace('<pre>', `<pre${matches[1]}>`);
|
|
10803
|
+
const result = md.renderer.render([token], md.options, {});
|
|
11220
10804
|
current.children.push({
|
|
11221
10805
|
type: token.type,
|
|
11222
10806
|
depth: depth + 1,
|
|
@@ -11242,7 +10826,7 @@ class Transformer {
|
|
|
11242
10826
|
cleanNode(root);
|
|
11243
10827
|
if (((_root$children = root.children) == null ? void 0 : _root$children.length) === 1) root = root.children[0];
|
|
11244
10828
|
resetDepth(root);
|
|
11245
|
-
return _extends
|
|
10829
|
+
return _extends({}, context, {
|
|
11246
10830
|
root
|
|
11247
10831
|
});
|
|
11248
10832
|
}
|
|
@@ -11262,8 +10846,8 @@ class Transformer {
|
|
|
11262
10846
|
}
|
|
11263
10847
|
}
|
|
11264
10848
|
return {
|
|
11265
|
-
styles,
|
|
11266
|
-
scripts
|
|
10849
|
+
styles: styles.map(item => patchCSSItem(this, item)),
|
|
10850
|
+
scripts: scripts.map(item => patchJSItem(this, item))
|
|
11267
10851
|
};
|
|
11268
10852
|
}
|
|
11269
10853
|
|
|
@@ -11274,17 +10858,52 @@ class Transformer {
|
|
|
11274
10858
|
const keys = this.plugins.map(plugin => plugin.name).filter(name => features[name]);
|
|
11275
10859
|
return this.getAssets(keys);
|
|
11276
10860
|
}
|
|
10861
|
+
fillTemplate(root, assets, extra) {
|
|
10862
|
+
var _extra, _extra$baseJs;
|
|
10863
|
+
extra = _extends({}, extra);
|
|
10864
|
+
(_extra$baseJs = (_extra = extra).baseJs) != null ? _extra$baseJs : _extra.baseJs = baseJsPaths.map(path => this.urlBuilder.getFullUrl(path)).map(path => markmapCommon.buildJSItem(path));
|
|
10865
|
+
const {
|
|
10866
|
+
scripts,
|
|
10867
|
+
styles
|
|
10868
|
+
} = assets;
|
|
10869
|
+
const cssList = [...(styles ? markmapCommon.persistCSS(styles) : [])];
|
|
10870
|
+
const context = {
|
|
10871
|
+
getMarkmap: () => window.markmap,
|
|
10872
|
+
getOptions: extra.getOptions,
|
|
10873
|
+
jsonOptions: extra.jsonOptions,
|
|
10874
|
+
root
|
|
10875
|
+
};
|
|
10876
|
+
const jsList = [...markmapCommon.persistJS([...extra.baseJs, ...(scripts || []), {
|
|
10877
|
+
type: 'iife',
|
|
10878
|
+
data: {
|
|
10879
|
+
fn: (getMarkmap, getOptions, root, jsonOptions) => {
|
|
10880
|
+
const markmap = getMarkmap();
|
|
10881
|
+
window.mm = markmap.Markmap.create('svg#mindmap', (getOptions || markmap.deriveOptions)(jsonOptions), root);
|
|
10882
|
+
},
|
|
10883
|
+
getParams: ({
|
|
10884
|
+
getMarkmap,
|
|
10885
|
+
getOptions,
|
|
10886
|
+
root,
|
|
10887
|
+
jsonOptions
|
|
10888
|
+
}) => {
|
|
10889
|
+
return [getMarkmap, getOptions, root, jsonOptions];
|
|
10890
|
+
}
|
|
10891
|
+
}
|
|
10892
|
+
}], context)];
|
|
10893
|
+
const html = template.replace('<!--CSS-->', () => cssList.join('')).replace('<!--JS-->', () => jsList.join(''));
|
|
10894
|
+
return html;
|
|
10895
|
+
}
|
|
11277
10896
|
}
|
|
11278
10897
|
|
|
11279
10898
|
const transformerVersions = {
|
|
11280
|
-
'markmap-lib': '0.14.5-alpha.
|
|
10899
|
+
'markmap-lib': '0.14.5-alpha.22+04afb38',
|
|
11281
10900
|
d3: "7.8.5"
|
|
11282
10901
|
};
|
|
11283
10902
|
|
|
11284
10903
|
exports.Transformer = Transformer;
|
|
11285
10904
|
exports.baseJsPaths = baseJsPaths;
|
|
11286
10905
|
exports.builtInPlugins = plugins;
|
|
11287
|
-
exports.
|
|
10906
|
+
exports.template = template;
|
|
11288
10907
|
exports.transformerVersions = transformerVersions;
|
|
11289
10908
|
|
|
11290
10909
|
}));
|