markmap-lib 0.13.4 → 0.13.6-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 +75 -7
- package/dist/browser/index.min.js +3 -3
- package/dist/index.esm.js +52 -7
- package/dist/index.js +52 -6
- package/package.json +12 -5
- package/types/index.d.ts +4 -0
- package/types/plugins/katex.config.d.ts +4 -0
- package/types/plugins/prism.config.d.ts +3 -0
- package/types/plugins/util.d.ts +4 -0
- package/types/types.d.ts +4 -2
package/dist/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! markmap-lib v0.13.
|
|
1
|
+
/*! markmap-lib v0.13.6-alpha.2+20a88ca | 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.6-alpha.2+20a88ca | MIT License */
|
|
31
31
|
class Hook {
|
|
32
32
|
constructor() {
|
|
33
33
|
this.listeners = [];
|
|
@@ -278,7 +278,7 @@ async function loadJS(items, context) {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
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";
|
|
281
|
-
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.
|
|
281
|
+
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.6-alpha.2+20a88ca"}`].map(src => ({
|
|
282
282
|
type: 'script',
|
|
283
283
|
data: {
|
|
284
284
|
src
|
|
@@ -8611,6 +8611,10 @@ const rkatex = (md, options) => {
|
|
|
8611
8611
|
var remarkableKatex = rkatex;
|
|
8612
8612
|
|
|
8613
8613
|
var config$1 = {
|
|
8614
|
+
versions: {
|
|
8615
|
+
katex: "0.15.3",
|
|
8616
|
+
webfontloader: "1.6.28"
|
|
8617
|
+
},
|
|
8614
8618
|
preloadScripts: [{
|
|
8615
8619
|
type: 'script',
|
|
8616
8620
|
data: {
|
|
@@ -8653,6 +8657,19 @@ var config$1 = {
|
|
|
8653
8657
|
}]
|
|
8654
8658
|
};
|
|
8655
8659
|
|
|
8660
|
+
/**
|
|
8661
|
+
* Find NPM paths and resolve them to full URLs with the same package version as in this library.
|
|
8662
|
+
*/
|
|
8663
|
+
function resolveNpmPaths(paths, name, version) {
|
|
8664
|
+
return paths.map(path => {
|
|
8665
|
+
if (typeof path === 'string' && path.startsWith(`${name}/`)) {
|
|
8666
|
+
return `https://cdn.jsdelivr.net/npm/${name}@${version}${path.slice(name.length)}`;
|
|
8667
|
+
}
|
|
8668
|
+
|
|
8669
|
+
return path;
|
|
8670
|
+
});
|
|
8671
|
+
}
|
|
8672
|
+
|
|
8656
8673
|
let loading$1;
|
|
8657
8674
|
|
|
8658
8675
|
const autoload$1 = () => {
|
|
@@ -8694,6 +8711,15 @@ function transform$2(transformHooks) {
|
|
|
8694
8711
|
enableFeature = () => {
|
|
8695
8712
|
context.features[name$2] = true;
|
|
8696
8713
|
};
|
|
8714
|
+
|
|
8715
|
+
const {
|
|
8716
|
+
frontmatter
|
|
8717
|
+
} = context;
|
|
8718
|
+
['extraJs', 'extraCss'].forEach(key => {
|
|
8719
|
+
if (frontmatter.markmap[key]) {
|
|
8720
|
+
frontmatter.markmap[key] = resolveNpmPaths(frontmatter.markmap[key], name$2, config$1.versions.katex);
|
|
8721
|
+
}
|
|
8722
|
+
});
|
|
8697
8723
|
});
|
|
8698
8724
|
return {
|
|
8699
8725
|
styles: config$1.styles,
|
|
@@ -8709,6 +8735,9 @@ transform: transform$2
|
|
|
8709
8735
|
});
|
|
8710
8736
|
|
|
8711
8737
|
var config = {
|
|
8738
|
+
versions: {
|
|
8739
|
+
prismjs: "1.28.0"
|
|
8740
|
+
},
|
|
8712
8741
|
preloadScripts: [{
|
|
8713
8742
|
type: 'script',
|
|
8714
8743
|
data: {
|
|
@@ -12644,13 +12673,21 @@ function transform(transformHooks) {
|
|
|
12644
12673
|
const endOffset = content.indexOf('\n---\n');
|
|
12645
12674
|
if (endOffset < 0) return;
|
|
12646
12675
|
const raw = content.slice(4, endOffset);
|
|
12676
|
+
let frontmatter;
|
|
12647
12677
|
|
|
12648
12678
|
try {
|
|
12649
|
-
|
|
12679
|
+
var _frontmatter;
|
|
12680
|
+
|
|
12681
|
+
frontmatter = jsYaml.load(raw);
|
|
12682
|
+
|
|
12683
|
+
if ((_frontmatter = frontmatter) != null && _frontmatter.markmap) {
|
|
12684
|
+
frontmatter.markmap = normalizeMarkmapJsonOptions(frontmatter.markmap);
|
|
12685
|
+
}
|
|
12650
12686
|
} catch (_unused) {
|
|
12651
12687
|
return;
|
|
12652
12688
|
}
|
|
12653
12689
|
|
|
12690
|
+
context.frontmatter = frontmatter;
|
|
12654
12691
|
const offset = endOffset + 5;
|
|
12655
12692
|
ctx.args[0] = content.slice(offset);
|
|
12656
12693
|
},
|
|
@@ -12664,6 +12701,30 @@ function transform(transformHooks) {
|
|
|
12664
12701
|
return {};
|
|
12665
12702
|
}
|
|
12666
12703
|
|
|
12704
|
+
function normalizeMarkmapJsonOptions(options) {
|
|
12705
|
+
if (!options) return;
|
|
12706
|
+
['color', 'extraJs', 'extraCss'].forEach(key => {
|
|
12707
|
+
if (options[key] != null) options[key] = normalizeStringArray(options[key]);
|
|
12708
|
+
});
|
|
12709
|
+
['duration', 'maxWidth', 'initialExpandLevel'].forEach(key => {
|
|
12710
|
+
if (options[key] != null) options[key] = normalizeNumber(options[key]);
|
|
12711
|
+
});
|
|
12712
|
+
return options;
|
|
12713
|
+
}
|
|
12714
|
+
|
|
12715
|
+
function normalizeStringArray(value) {
|
|
12716
|
+
var _result;
|
|
12717
|
+
|
|
12718
|
+
let result;
|
|
12719
|
+
if (typeof value === 'string') result = [value];else if (Array.isArray(value)) result = value.filter(item => item && typeof item === 'string');
|
|
12720
|
+
return (_result = result) != null && _result.length ? result : undefined;
|
|
12721
|
+
}
|
|
12722
|
+
|
|
12723
|
+
function normalizeNumber(value) {
|
|
12724
|
+
if (isNaN(+value)) return;
|
|
12725
|
+
return +value;
|
|
12726
|
+
}
|
|
12727
|
+
|
|
12667
12728
|
var frontmatter = /*#__PURE__*/Object.freeze({
|
|
12668
12729
|
__proto__: null,
|
|
12669
12730
|
name: name,
|
|
@@ -12679,7 +12740,7 @@ function createTransformHooks() {
|
|
|
12679
12740
|
};
|
|
12680
12741
|
}
|
|
12681
12742
|
|
|
12682
|
-
const plugins = [katex, prism
|
|
12743
|
+
const plugins = [frontmatter, katex, prism];
|
|
12683
12744
|
|
|
12684
12745
|
function cleanNode(node) {
|
|
12685
12746
|
if (node.type === 'heading') {
|
|
@@ -12885,7 +12946,7 @@ class Transformer {
|
|
|
12885
12946
|
|
|
12886
12947
|
const styles = [];
|
|
12887
12948
|
const scripts = [];
|
|
12888
|
-
(_keys = keys) != null ? _keys : keys =
|
|
12949
|
+
(_keys = keys) != null ? _keys : keys = this.plugins.map(plugin => plugin.name);
|
|
12889
12950
|
|
|
12890
12951
|
for (const assets of keys.map(key => this.assetsMap[key])) {
|
|
12891
12952
|
if (assets) {
|
|
@@ -12905,13 +12966,20 @@ class Transformer {
|
|
|
12905
12966
|
|
|
12906
12967
|
|
|
12907
12968
|
getUsedAssets(features) {
|
|
12908
|
-
|
|
12969
|
+
const keys = this.plugins.map(plugin => plugin.name).filter(name => features[name]);
|
|
12970
|
+
return this.getAssets(keys);
|
|
12909
12971
|
}
|
|
12910
12972
|
|
|
12911
12973
|
}
|
|
12912
12974
|
|
|
12975
|
+
const transformerVersions = {
|
|
12976
|
+
'markmap-lib': '0.13.6-alpha.2+20a88ca',
|
|
12977
|
+
d3: "6.7.0"
|
|
12978
|
+
};
|
|
12979
|
+
|
|
12913
12980
|
exports.Transformer = Transformer;
|
|
12914
12981
|
exports.builtInPlugins = plugins;
|
|
12915
12982
|
exports.fillTemplate = fillTemplate;
|
|
12983
|
+
exports.transformerVersions = transformerVersions;
|
|
12916
12984
|
|
|
12917
12985
|
}));
|