markmap-lib 0.14.5-alpha.18 → 0.14.5-alpha.21
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 +73 -470
- package/dist/browser/index.mjs +184 -10962
- package/dist/index.js +52 -67
- package/dist/index.mjs +52 -67
- package/package.json +9 -8
- package/types/plugins/hljs.d.ts +2 -0
- package/types/plugins/katex.config.d.ts +1 -0
- package/types/plugins/prism.config.d.ts +1 -0
package/dist/browser/index.js
CHANGED
|
@@ -1,47 +1,10 @@
|
|
|
1
|
-
/*! markmap-lib v0.14.5-alpha.
|
|
1
|
+
/*! markmap-lib v0.14.5-alpha.21+fb81f2c | 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$1) { 'use strict';
|
|
7
7
|
|
|
8
|
-
function _extends$1() {
|
|
9
|
-
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
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
|
-
}
|
|
22
|
-
|
|
23
|
-
/*! markmap-common v0.14.5-alpha.18+44c9639 | 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
8
|
function _extends() {
|
|
46
9
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
47
10
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -56,358 +19,25 @@ function _extends() {
|
|
|
56
19
|
};
|
|
57
20
|
return _extends.apply(this, arguments);
|
|
58
21
|
}
|
|
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
22
|
|
|
393
23
|
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@${"
|
|
24
|
+
const baseJsPaths = [`d3@${"7.8.5"}/dist/d3.min.js`, `markmap-view@${"0.14.5-alpha.21"}/dist/browser/index.js`];
|
|
395
25
|
function fillTemplate(root, assets, extra) {
|
|
396
26
|
var _extra, _extra$baseJs;
|
|
397
|
-
extra = _extends
|
|
398
|
-
(_extra$baseJs = (_extra = extra).baseJs) != null ? _extra$baseJs : _extra.baseJs = baseJsPaths.map(path => buildJSItem(path));
|
|
27
|
+
extra = _extends({}, extra);
|
|
28
|
+
(_extra$baseJs = (_extra = extra).baseJs) != null ? _extra$baseJs : _extra.baseJs = baseJsPaths.map(path => markmapCommon.buildJSItem(path));
|
|
399
29
|
const {
|
|
400
30
|
scripts,
|
|
401
31
|
styles
|
|
402
32
|
} = assets;
|
|
403
|
-
const cssList = [...(styles ? persistCSS(styles) : [])];
|
|
33
|
+
const cssList = [...(styles ? markmapCommon.persistCSS(styles) : [])];
|
|
404
34
|
const context = {
|
|
405
35
|
getMarkmap: () => window.markmap,
|
|
406
36
|
getOptions: extra.getOptions,
|
|
407
37
|
jsonOptions: extra.jsonOptions,
|
|
408
38
|
root
|
|
409
39
|
};
|
|
410
|
-
const jsList = [...persistJS([...extra.baseJs, ...(scripts || []), {
|
|
40
|
+
const jsList = [...markmapCommon.persistJS([...extra.baseJs, ...(scripts || []), {
|
|
411
41
|
type: 'iife',
|
|
412
42
|
data: {
|
|
413
43
|
fn: (getMarkmap, getOptions, root, jsonOptions) => {
|
|
@@ -7688,14 +7318,15 @@ var remarkableKatex = rkatex;
|
|
|
7688
7318
|
|
|
7689
7319
|
var remarkableKatex$1 = /*@__PURE__*/getDefaultExportFromCjs(remarkableKatex);
|
|
7690
7320
|
|
|
7321
|
+
const name$3 = 'katex';
|
|
7691
7322
|
function getConfig$1() {
|
|
7692
|
-
const preloadScripts = [`katex@${"0.16.
|
|
7693
|
-
const webfontloader = buildJSItem(`webfontloader@${"1.6.28"}/webfontloader.js`);
|
|
7323
|
+
const preloadScripts = [`katex@${"0.16.8"}/dist/katex.min.js`].map(path => markmapCommon.buildJSItem(path));
|
|
7324
|
+
const webfontloader = markmapCommon.buildJSItem(`webfontloader@${"1.6.28"}/webfontloader.js`);
|
|
7694
7325
|
webfontloader.data.defer = true;
|
|
7695
|
-
const styles = [`katex@${"0.16.
|
|
7326
|
+
const styles = [`katex@${"0.16.8"}/dist/katex.min.css`].map(path => markmapCommon.buildCSSItem(path));
|
|
7696
7327
|
return {
|
|
7697
7328
|
versions: {
|
|
7698
|
-
katex: "0.16.
|
|
7329
|
+
katex: "0.16.8" ,
|
|
7699
7330
|
webfontloader: "1.6.28"
|
|
7700
7331
|
},
|
|
7701
7332
|
preloadScripts,
|
|
@@ -7743,11 +7374,11 @@ function addDefaultVersions(paths, name, version) {
|
|
|
7743
7374
|
|
|
7744
7375
|
function createTransformHooks() {
|
|
7745
7376
|
return {
|
|
7746
|
-
parser: new Hook(),
|
|
7747
|
-
beforeParse: new Hook(),
|
|
7748
|
-
afterParse: new Hook(),
|
|
7749
|
-
htmltag: new Hook(),
|
|
7750
|
-
retransform: new Hook()
|
|
7377
|
+
parser: new markmapCommon.Hook(),
|
|
7378
|
+
beforeParse: new markmapCommon.Hook(),
|
|
7379
|
+
afterParse: new markmapCommon.Hook(),
|
|
7380
|
+
htmltag: new markmapCommon.Hook(),
|
|
7381
|
+
retransform: new markmapCommon.Hook()
|
|
7751
7382
|
};
|
|
7752
7383
|
}
|
|
7753
7384
|
|
|
@@ -7758,7 +7389,6 @@ function definePlugin(plugin) {
|
|
|
7758
7389
|
return plugin;
|
|
7759
7390
|
}
|
|
7760
7391
|
|
|
7761
|
-
const name$3 = 'katex';
|
|
7762
7392
|
var katex = definePlugin(() => {
|
|
7763
7393
|
const plugin = {
|
|
7764
7394
|
name: name$3,
|
|
@@ -7766,7 +7396,7 @@ var katex = definePlugin(() => {
|
|
|
7766
7396
|
transform(transformHooks) {
|
|
7767
7397
|
let loading;
|
|
7768
7398
|
const autoload = () => {
|
|
7769
|
-
loading || (loading = loadJS(plugin.config.preloadScripts));
|
|
7399
|
+
loading || (loading = markmapCommon.loadJS(plugin.config.preloadScripts));
|
|
7770
7400
|
return loading;
|
|
7771
7401
|
};
|
|
7772
7402
|
const renderKatex = (source, displayMode) => {
|
|
@@ -7784,7 +7414,7 @@ var katex = definePlugin(() => {
|
|
|
7784
7414
|
});
|
|
7785
7415
|
return source;
|
|
7786
7416
|
};
|
|
7787
|
-
let enableFeature = noop;
|
|
7417
|
+
let enableFeature = markmapCommon.noop;
|
|
7788
7418
|
transformHooks.parser.tap(md => {
|
|
7789
7419
|
md.use(remarkableKatex$1);
|
|
7790
7420
|
md.renderer.rules.katex = (tokens, idx) => {
|
|
@@ -7819,67 +7449,6 @@ var katex = definePlugin(() => {
|
|
|
7819
7449
|
return plugin;
|
|
7820
7450
|
});
|
|
7821
7451
|
|
|
7822
|
-
function getConfig() {
|
|
7823
|
-
const preloadScripts = [`prismjs@${"1.28.0"}/components/prism-core.min.js`, `prismjs@${"1.28.0"}/plugins/autoloader/prism-autoloader.min.js`].map(path => buildJSItem(path));
|
|
7824
|
-
const styles = [`prismjs@${"1.28.0"}/themes/prism.css`].map(path => buildCSSItem(path));
|
|
7825
|
-
return {
|
|
7826
|
-
versions: {
|
|
7827
|
-
prismjs: "1.28.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;
|
|
7844
|
-
};
|
|
7845
|
-
function loadLanguageAndRefresh(lang, transformHooks) {
|
|
7846
|
-
autoload().then(() => {
|
|
7847
|
-
window.Prism.plugins.autoloader.loadLanguages([lang], () => {
|
|
7848
|
-
transformHooks.retransform.call();
|
|
7849
|
-
});
|
|
7850
|
-
});
|
|
7851
|
-
}
|
|
7852
|
-
let enableFeature = noop;
|
|
7853
|
-
transformHooks.parser.tap(md => {
|
|
7854
|
-
md.set({
|
|
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);
|
|
7867
|
-
}
|
|
7868
|
-
});
|
|
7869
|
-
});
|
|
7870
|
-
transformHooks.beforeParse.tap((_, context) => {
|
|
7871
|
-
enableFeature = () => {
|
|
7872
|
-
context.features[name$2] = true;
|
|
7873
|
-
};
|
|
7874
|
-
});
|
|
7875
|
-
return {
|
|
7876
|
-
styles: plugin.config.styles
|
|
7877
|
-
};
|
|
7878
|
-
}
|
|
7879
|
-
};
|
|
7880
|
-
return plugin;
|
|
7881
|
-
});
|
|
7882
|
-
|
|
7883
7452
|
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
|
|
7884
7453
|
function isNothing(subject) {
|
|
7885
7454
|
return typeof subject === 'undefined' || subject === null;
|
|
@@ -10991,9 +10560,9 @@ var jsYaml = {
|
|
|
10991
10560
|
safeDump: safeDump
|
|
10992
10561
|
};
|
|
10993
10562
|
|
|
10994
|
-
const name$
|
|
10563
|
+
const name$2 = 'frontmatter';
|
|
10995
10564
|
var frontmatter = definePlugin({
|
|
10996
|
-
name: name$
|
|
10565
|
+
name: name$2,
|
|
10997
10566
|
transform(transformHooks) {
|
|
10998
10567
|
transformHooks.beforeParse.tap((md, context) => {
|
|
10999
10568
|
const {
|
|
@@ -11041,9 +10610,9 @@ function normalizeNumber(value) {
|
|
|
11041
10610
|
return +value;
|
|
11042
10611
|
}
|
|
11043
10612
|
|
|
11044
|
-
const name = 'npmUrl';
|
|
10613
|
+
const name$1 = 'npmUrl';
|
|
11045
10614
|
var npmUrl = definePlugin({
|
|
11046
|
-
name,
|
|
10615
|
+
name: name$1,
|
|
11047
10616
|
transform(transformHooks) {
|
|
11048
10617
|
transformHooks.afterParse.tap((_, context) => {
|
|
11049
10618
|
const {
|
|
@@ -11056,7 +10625,7 @@ var npmUrl = definePlugin({
|
|
|
11056
10625
|
if (value) {
|
|
11057
10626
|
markmap[key] = value.map(path => {
|
|
11058
10627
|
if (path.startsWith('npm:')) {
|
|
11059
|
-
return getFullUrl(path.slice(4));
|
|
10628
|
+
return markmapCommon.getFullUrl(path.slice(4));
|
|
11060
10629
|
}
|
|
11061
10630
|
return path;
|
|
11062
10631
|
});
|
|
@@ -11068,7 +10637,44 @@ var npmUrl = definePlugin({
|
|
|
11068
10637
|
}
|
|
11069
10638
|
});
|
|
11070
10639
|
|
|
11071
|
-
const
|
|
10640
|
+
const name = 'hljs';
|
|
10641
|
+
function getConfig() {
|
|
10642
|
+
const styles = [`highlight.js@${"11.8.0"}/styles/default.css`].map(path => markmapCommon.buildCSSItem(path));
|
|
10643
|
+
return {
|
|
10644
|
+
versions: {
|
|
10645
|
+
hljs: "11.8.0"
|
|
10646
|
+
},
|
|
10647
|
+
styles
|
|
10648
|
+
};
|
|
10649
|
+
}
|
|
10650
|
+
var hljs = definePlugin(() => {
|
|
10651
|
+
const plugin = {
|
|
10652
|
+
name,
|
|
10653
|
+
config: getConfig(),
|
|
10654
|
+
transform(transformHooks) {
|
|
10655
|
+
let enableFeature = markmapCommon.noop;
|
|
10656
|
+
transformHooks.parser.tap(md => {
|
|
10657
|
+
md.set({
|
|
10658
|
+
highlight: (str, language) => {
|
|
10659
|
+
enableFeature();
|
|
10660
|
+
return hljs$1.highlightAuto(str, language ? [language] : undefined).value;
|
|
10661
|
+
}
|
|
10662
|
+
});
|
|
10663
|
+
});
|
|
10664
|
+
transformHooks.beforeParse.tap((_, context) => {
|
|
10665
|
+
enableFeature = () => {
|
|
10666
|
+
context.features[name] = true;
|
|
10667
|
+
};
|
|
10668
|
+
});
|
|
10669
|
+
return {
|
|
10670
|
+
styles: plugin.config.styles
|
|
10671
|
+
};
|
|
10672
|
+
}
|
|
10673
|
+
};
|
|
10674
|
+
return plugin;
|
|
10675
|
+
});
|
|
10676
|
+
|
|
10677
|
+
const plugins = [frontmatter, katex, hljs, npmUrl];
|
|
11072
10678
|
|
|
11073
10679
|
function cleanNode(node) {
|
|
11074
10680
|
if (node.type === 'heading') {
|
|
@@ -11081,7 +10687,7 @@ function cleanNode(node) {
|
|
|
11081
10687
|
if (['paragraph', 'fence'].includes(item.type)) {
|
|
11082
10688
|
if (!node.content) {
|
|
11083
10689
|
node.content = item.content;
|
|
11084
|
-
node.payload = _extends
|
|
10690
|
+
node.payload = _extends({}, node.payload, item.payload);
|
|
11085
10691
|
}
|
|
11086
10692
|
return false;
|
|
11087
10693
|
}
|
|
@@ -11095,7 +10701,7 @@ function cleanNode(node) {
|
|
|
11095
10701
|
let index = (_node$payload$startIn = (_node$payload2 = node.payload) == null ? void 0 : _node$payload2.startIndex) != null ? _node$payload$startIn : 1;
|
|
11096
10702
|
node.children.forEach(item => {
|
|
11097
10703
|
if (item.type === 'list_item') {
|
|
11098
|
-
item.payload = _extends
|
|
10704
|
+
item.payload = _extends({}, item.payload, {
|
|
11099
10705
|
index
|
|
11100
10706
|
});
|
|
11101
10707
|
index += 1;
|
|
@@ -11133,7 +10739,7 @@ class Transformer {
|
|
|
11133
10739
|
breaks: true,
|
|
11134
10740
|
maxNesting: Infinity
|
|
11135
10741
|
});
|
|
11136
|
-
md.renderer.rules.htmltag = wrapFunction(md.renderer.rules.htmltag, (render, ...args) => {
|
|
10742
|
+
md.renderer.rules.htmltag = markmapCommon.wrapFunction(md.renderer.rules.htmltag, (render, ...args) => {
|
|
11137
10743
|
const result = render(...args);
|
|
11138
10744
|
this.hooks.htmltag.call({
|
|
11139
10745
|
args,
|
|
@@ -11203,7 +10809,7 @@ class Transformer {
|
|
|
11203
10809
|
const comment = (_ctx$result = ctx.result) == null ? void 0 : _ctx$result.match(/^<!--([\s\S]*?)-->$/);
|
|
11204
10810
|
const data = comment == null ? void 0 : comment[1].trim().split(' ');
|
|
11205
10811
|
if ((data == null ? void 0 : data[0]) === 'fold') {
|
|
11206
|
-
current.payload = _extends
|
|
10812
|
+
current.payload = _extends({}, current.payload, {
|
|
11207
10813
|
fold: ['all', 'recursively'].includes(data[1]) ? 2 : 1
|
|
11208
10814
|
});
|
|
11209
10815
|
ctx.result = '';
|
|
@@ -11213,10 +10819,7 @@ class Transformer {
|
|
|
11213
10819
|
revoke();
|
|
11214
10820
|
current.content = `${current.content || ''}${text}`;
|
|
11215
10821
|
} 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]}>`);
|
|
10822
|
+
const result = md.renderer.render([token], md.options, {});
|
|
11220
10823
|
current.children.push({
|
|
11221
10824
|
type: token.type,
|
|
11222
10825
|
depth: depth + 1,
|
|
@@ -11242,7 +10845,7 @@ class Transformer {
|
|
|
11242
10845
|
cleanNode(root);
|
|
11243
10846
|
if (((_root$children = root.children) == null ? void 0 : _root$children.length) === 1) root = root.children[0];
|
|
11244
10847
|
resetDepth(root);
|
|
11245
|
-
return _extends
|
|
10848
|
+
return _extends({}, context, {
|
|
11246
10849
|
root
|
|
11247
10850
|
});
|
|
11248
10851
|
}
|
|
@@ -11277,8 +10880,8 @@ class Transformer {
|
|
|
11277
10880
|
}
|
|
11278
10881
|
|
|
11279
10882
|
const transformerVersions = {
|
|
11280
|
-
'markmap-lib': '0.14.5-alpha.
|
|
11281
|
-
d3: "
|
|
10883
|
+
'markmap-lib': '0.14.5-alpha.21+fb81f2c',
|
|
10884
|
+
d3: "7.8.5"
|
|
11282
10885
|
};
|
|
11283
10886
|
|
|
11284
10887
|
exports.Transformer = Transformer;
|