markmap-lib 0.13.2 → 0.13.3-alpha.2
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 +96 -63
- package/dist/browser/index.min.js +3 -3
- package/dist/index.esm.js +70 -47
- package/dist/index.js +70 -47
- package/package.json +5 -4
- package/types/plugins/katex.browser.d.ts +2 -0
- package/types/plugins/katex.options.d.ts +7 -0
- package/types/plugins/prism.browser.d.ts +2 -0
- package/types/plugins/prism.options.d.ts +6 -0
- package/types/template.d.ts +2 -3
package/dist/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! markmap-lib v0.13.2 | MIT License */
|
|
1
|
+
/*! markmap-lib v0.13.3-alpha.2+a5a159b | MIT License */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('katex')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'katex'], factory) :
|
|
@@ -27,7 +27,7 @@ function _extends$1() {
|
|
|
27
27
|
return _extends$1.apply(this, arguments);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/*! markmap-common v0.13.
|
|
30
|
+
/*! markmap-common v0.13.3-alpha.2+a5a159b | MIT License */
|
|
31
31
|
class Hook {
|
|
32
32
|
constructor() {
|
|
33
33
|
this.listeners = [];
|
|
@@ -73,6 +73,23 @@ function _extends() {
|
|
|
73
73
|
return _extends.apply(this, arguments);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
77
|
+
if (source == null) return {};
|
|
78
|
+
var target = {};
|
|
79
|
+
var sourceKeys = Object.keys(source);
|
|
80
|
+
var key, i;
|
|
81
|
+
|
|
82
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
83
|
+
key = sourceKeys[i];
|
|
84
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
85
|
+
target[key] = source[key];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return target;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const _excluded = ["textContent"];
|
|
92
|
+
|
|
76
93
|
function escapeHtml$1(html) {
|
|
77
94
|
return html.replace(/[&<"]/g, m => ({
|
|
78
95
|
'&': '&',
|
|
@@ -114,7 +131,15 @@ function buildCode(fn, args) {
|
|
|
114
131
|
|
|
115
132
|
function persistJS(items, context) {
|
|
116
133
|
return items.map(item => {
|
|
117
|
-
if (item.type === 'script')
|
|
134
|
+
if (item.type === 'script') {
|
|
135
|
+
const _item$data = item.data,
|
|
136
|
+
{
|
|
137
|
+
textContent
|
|
138
|
+
} = _item$data,
|
|
139
|
+
rest = _objectWithoutPropertiesLoose(_item$data, _excluded);
|
|
140
|
+
|
|
141
|
+
return wrapHtml('script', textContent, rest);
|
|
142
|
+
}
|
|
118
143
|
|
|
119
144
|
if (item.type === 'iife') {
|
|
120
145
|
const {
|
|
@@ -253,15 +278,12 @@ async function loadJS(items, context) {
|
|
|
253
278
|
}
|
|
254
279
|
|
|
255
280
|
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";
|
|
256
|
-
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.2"}`].map(src => ({
|
|
281
|
+
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.3-alpha.2+a5a159b"}`].map(src => ({
|
|
257
282
|
type: 'script',
|
|
258
283
|
data: {
|
|
259
284
|
src
|
|
260
285
|
}
|
|
261
286
|
}));
|
|
262
|
-
|
|
263
|
-
const defaultGetOptions = (markmap, jsonOptions) => markmap.deriveOptions(jsonOptions);
|
|
264
|
-
|
|
265
287
|
function fillTemplate(root, assets, extra) {
|
|
266
288
|
extra = _extends$1({
|
|
267
289
|
baseJs: BASE_JS
|
|
@@ -273,7 +295,7 @@ function fillTemplate(root, assets, extra) {
|
|
|
273
295
|
const cssList = [...(styles ? persistCSS(styles) : [])];
|
|
274
296
|
const context = {
|
|
275
297
|
getMarkmap: () => window.markmap,
|
|
276
|
-
getOptions: extra.getOptions
|
|
298
|
+
getOptions: extra.getOptions,
|
|
277
299
|
jsonOptions: extra.jsonOptions,
|
|
278
300
|
root
|
|
279
301
|
};
|
|
@@ -282,7 +304,7 @@ function fillTemplate(root, assets, extra) {
|
|
|
282
304
|
data: {
|
|
283
305
|
fn: (getMarkmap, getOptions, root, jsonOptions) => {
|
|
284
306
|
const markmap = getMarkmap();
|
|
285
|
-
window.mm = markmap.Markmap.create('svg#mindmap', getOptions
|
|
307
|
+
window.mm = markmap.Markmap.create('svg#mindmap', (getOptions || markmap.deriveOptions)(jsonOptions), root);
|
|
286
308
|
},
|
|
287
309
|
getParams: ({
|
|
288
310
|
getMarkmap,
|
|
@@ -8588,18 +8610,55 @@ const rkatex = (md, options) => {
|
|
|
8588
8610
|
|
|
8589
8611
|
var remarkableKatex = rkatex;
|
|
8590
8612
|
|
|
8591
|
-
|
|
8613
|
+
var options$1 = {
|
|
8614
|
+
preloadScripts: [{
|
|
8615
|
+
type: 'script',
|
|
8616
|
+
data: {
|
|
8617
|
+
src: `https://cdn.jsdelivr.net/npm/katex@${"0.15.3"}/dist/katex.min.js`
|
|
8618
|
+
}
|
|
8619
|
+
}],
|
|
8620
|
+
scripts: [{
|
|
8621
|
+
type: 'iife',
|
|
8622
|
+
data: {
|
|
8623
|
+
fn: getMarkmap => {
|
|
8624
|
+
window.WebFontConfig = {
|
|
8625
|
+
custom: {
|
|
8626
|
+
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']
|
|
8627
|
+
},
|
|
8628
|
+
active: () => {
|
|
8629
|
+
getMarkmap().refreshHook.call();
|
|
8630
|
+
}
|
|
8631
|
+
};
|
|
8632
|
+
},
|
|
8592
8633
|
|
|
8593
|
-
|
|
8594
|
-
|
|
8634
|
+
getParams({
|
|
8635
|
+
getMarkmap
|
|
8636
|
+
}) {
|
|
8637
|
+
return [getMarkmap];
|
|
8638
|
+
}
|
|
8639
|
+
|
|
8640
|
+
}
|
|
8641
|
+
}, {
|
|
8595
8642
|
type: 'script',
|
|
8596
8643
|
data: {
|
|
8597
|
-
src:
|
|
8644
|
+
src: `https://cdn.jsdelivr.net/npm/webfontloader@${"1.6.28"}/webfontloader.js`,
|
|
8645
|
+
defer: true
|
|
8598
8646
|
}
|
|
8599
|
-
}]
|
|
8600
|
-
|
|
8647
|
+
}],
|
|
8648
|
+
styles: [{
|
|
8649
|
+
type: 'stylesheet',
|
|
8650
|
+
data: {
|
|
8651
|
+
href: `https://cdn.jsdelivr.net/npm/katex@${"0.15.3"}/dist/katex.min.css`
|
|
8652
|
+
}
|
|
8653
|
+
}]
|
|
8601
8654
|
};
|
|
8602
8655
|
|
|
8656
|
+
let loading$1;
|
|
8657
|
+
|
|
8658
|
+
const autoload$1 = () => {
|
|
8659
|
+
loading$1 || (loading$1 = loadJS(options$1.preloadScripts));
|
|
8660
|
+
return loading$1;
|
|
8661
|
+
};
|
|
8603
8662
|
const name$2 = 'katex';
|
|
8604
8663
|
function transform$2(transformHooks) {
|
|
8605
8664
|
const renderKatex = (source, displayMode) => {
|
|
@@ -8637,63 +8696,42 @@ function transform$2(transformHooks) {
|
|
|
8637
8696
|
};
|
|
8638
8697
|
});
|
|
8639
8698
|
return {
|
|
8640
|
-
styles:
|
|
8641
|
-
|
|
8642
|
-
data: {
|
|
8643
|
-
href: 'https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css'
|
|
8644
|
-
}
|
|
8645
|
-
}],
|
|
8646
|
-
scripts: [{
|
|
8647
|
-
type: 'iife',
|
|
8648
|
-
data: {
|
|
8649
|
-
fn: getMarkmap => {
|
|
8650
|
-
window.WebFontConfig = {
|
|
8651
|
-
custom: {
|
|
8652
|
-
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']
|
|
8653
|
-
},
|
|
8654
|
-
active: () => {
|
|
8655
|
-
getMarkmap().refreshHook.call();
|
|
8656
|
-
}
|
|
8657
|
-
};
|
|
8658
|
-
},
|
|
8659
|
-
|
|
8660
|
-
getParams({
|
|
8661
|
-
getMarkmap
|
|
8662
|
-
}) {
|
|
8663
|
-
return [getMarkmap];
|
|
8664
|
-
}
|
|
8665
|
-
|
|
8666
|
-
}
|
|
8667
|
-
}, {
|
|
8668
|
-
type: 'script',
|
|
8669
|
-
data: {
|
|
8670
|
-
src: 'https://cdn.jsdelivr.net/npm/webfontloader@1.6.28/webfontloader.js',
|
|
8671
|
-
defer: true
|
|
8672
|
-
}
|
|
8673
|
-
}]
|
|
8699
|
+
styles: options$1.styles,
|
|
8700
|
+
scripts: options$1.scripts
|
|
8674
8701
|
};
|
|
8675
8702
|
}
|
|
8676
8703
|
|
|
8677
8704
|
var katex = /*#__PURE__*/Object.freeze({
|
|
8678
8705
|
__proto__: null,
|
|
8706
|
+
options: options$1,
|
|
8679
8707
|
name: name$2,
|
|
8680
8708
|
transform: transform$2
|
|
8681
8709
|
});
|
|
8682
8710
|
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
const autoload = () => {
|
|
8686
|
-
loading || (loading = loadJS([{
|
|
8711
|
+
var options = {
|
|
8712
|
+
preloadScripts: [{
|
|
8687
8713
|
type: 'script',
|
|
8688
8714
|
data: {
|
|
8689
|
-
src: `https://cdn.jsdelivr.net/npm/prismjs@${"1.
|
|
8715
|
+
src: `https://cdn.jsdelivr.net/npm/prismjs@${"1.28.0"}/components/prism-core.min.js`
|
|
8690
8716
|
}
|
|
8691
8717
|
}, {
|
|
8692
8718
|
type: 'script',
|
|
8693
8719
|
data: {
|
|
8694
|
-
src: `https://cdn.jsdelivr.net/npm/prismjs@${"1.
|
|
8720
|
+
src: `https://cdn.jsdelivr.net/npm/prismjs@${"1.28.0"}/plugins/autoloader/prism-autoloader.min.js`
|
|
8695
8721
|
}
|
|
8696
|
-
}]
|
|
8722
|
+
}],
|
|
8723
|
+
styles: [{
|
|
8724
|
+
type: 'stylesheet',
|
|
8725
|
+
data: {
|
|
8726
|
+
href: `https://cdn.jsdelivr.net/npm/prismjs@${"1.28.0"}/themes/prism.css`
|
|
8727
|
+
}
|
|
8728
|
+
}]
|
|
8729
|
+
};
|
|
8730
|
+
|
|
8731
|
+
let loading;
|
|
8732
|
+
|
|
8733
|
+
const autoload = () => {
|
|
8734
|
+
loading || (loading = loadJS(options.preloadScripts));
|
|
8697
8735
|
return loading;
|
|
8698
8736
|
};
|
|
8699
8737
|
|
|
@@ -8704,7 +8742,6 @@ function loadLanguageAndRefresh(lang, transformHooks) {
|
|
|
8704
8742
|
});
|
|
8705
8743
|
});
|
|
8706
8744
|
}
|
|
8707
|
-
|
|
8708
8745
|
const name$1 = 'prism';
|
|
8709
8746
|
function transform$1(transformHooks) {
|
|
8710
8747
|
let enableFeature = () => {};
|
|
@@ -8735,17 +8772,13 @@ function transform$1(transformHooks) {
|
|
|
8735
8772
|
};
|
|
8736
8773
|
});
|
|
8737
8774
|
return {
|
|
8738
|
-
styles:
|
|
8739
|
-
type: 'stylesheet',
|
|
8740
|
-
data: {
|
|
8741
|
-
href: `https://cdn.jsdelivr.net/npm/prismjs@${"1.25.0"}/themes/prism.css`
|
|
8742
|
-
}
|
|
8743
|
-
}]
|
|
8775
|
+
styles: options.styles
|
|
8744
8776
|
};
|
|
8745
8777
|
}
|
|
8746
8778
|
|
|
8747
8779
|
var prism = /*#__PURE__*/Object.freeze({
|
|
8748
8780
|
__proto__: null,
|
|
8781
|
+
options: options,
|
|
8749
8782
|
name: name$1,
|
|
8750
8783
|
transform: transform$1
|
|
8751
8784
|
});
|