markmap-lib 0.13.5-alpha.0 → 0.13.6-alpha.3
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 +77 -6
- package/dist/browser/index.min.js +3 -3
- package/dist/index.esm.js +52 -7
- package/dist/index.js +52 -6
- package/package.json +11 -4
- 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.3+3e26a91 | 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) :
|
|
@@ -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.5
|
|
281
|
+
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.5"}`].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,18 @@ function transform$2(transformHooks) {
|
|
|
8694
8711
|
enableFeature = () => {
|
|
8695
8712
|
context.features[name$2] = true;
|
|
8696
8713
|
};
|
|
8714
|
+
|
|
8715
|
+
const {
|
|
8716
|
+
frontmatter
|
|
8717
|
+
} = context;
|
|
8718
|
+
|
|
8719
|
+
if (frontmatter != null && frontmatter.markmap) {
|
|
8720
|
+
['extraJs', 'extraCss'].forEach(key => {
|
|
8721
|
+
if (frontmatter.markmap[key]) {
|
|
8722
|
+
frontmatter.markmap[key] = resolveNpmPaths(frontmatter.markmap[key], name$2, config$1.versions.katex);
|
|
8723
|
+
}
|
|
8724
|
+
});
|
|
8725
|
+
}
|
|
8697
8726
|
});
|
|
8698
8727
|
return {
|
|
8699
8728
|
styles: config$1.styles,
|
|
@@ -8709,6 +8738,9 @@ transform: transform$2
|
|
|
8709
8738
|
});
|
|
8710
8739
|
|
|
8711
8740
|
var config = {
|
|
8741
|
+
versions: {
|
|
8742
|
+
prismjs: "1.28.0"
|
|
8743
|
+
},
|
|
8712
8744
|
preloadScripts: [{
|
|
8713
8745
|
type: 'script',
|
|
8714
8746
|
data: {
|
|
@@ -12644,13 +12676,21 @@ function transform(transformHooks) {
|
|
|
12644
12676
|
const endOffset = content.indexOf('\n---\n');
|
|
12645
12677
|
if (endOffset < 0) return;
|
|
12646
12678
|
const raw = content.slice(4, endOffset);
|
|
12679
|
+
let frontmatter;
|
|
12647
12680
|
|
|
12648
12681
|
try {
|
|
12649
|
-
|
|
12682
|
+
var _frontmatter;
|
|
12683
|
+
|
|
12684
|
+
frontmatter = jsYaml.load(raw);
|
|
12685
|
+
|
|
12686
|
+
if ((_frontmatter = frontmatter) != null && _frontmatter.markmap) {
|
|
12687
|
+
frontmatter.markmap = normalizeMarkmapJsonOptions(frontmatter.markmap);
|
|
12688
|
+
}
|
|
12650
12689
|
} catch (_unused) {
|
|
12651
12690
|
return;
|
|
12652
12691
|
}
|
|
12653
12692
|
|
|
12693
|
+
context.frontmatter = frontmatter;
|
|
12654
12694
|
const offset = endOffset + 5;
|
|
12655
12695
|
ctx.args[0] = content.slice(offset);
|
|
12656
12696
|
},
|
|
@@ -12664,6 +12704,30 @@ function transform(transformHooks) {
|
|
|
12664
12704
|
return {};
|
|
12665
12705
|
}
|
|
12666
12706
|
|
|
12707
|
+
function normalizeMarkmapJsonOptions(options) {
|
|
12708
|
+
if (!options) return;
|
|
12709
|
+
['color', 'extraJs', 'extraCss'].forEach(key => {
|
|
12710
|
+
if (options[key] != null) options[key] = normalizeStringArray(options[key]);
|
|
12711
|
+
});
|
|
12712
|
+
['duration', 'maxWidth', 'initialExpandLevel'].forEach(key => {
|
|
12713
|
+
if (options[key] != null) options[key] = normalizeNumber(options[key]);
|
|
12714
|
+
});
|
|
12715
|
+
return options;
|
|
12716
|
+
}
|
|
12717
|
+
|
|
12718
|
+
function normalizeStringArray(value) {
|
|
12719
|
+
var _result;
|
|
12720
|
+
|
|
12721
|
+
let result;
|
|
12722
|
+
if (typeof value === 'string') result = [value];else if (Array.isArray(value)) result = value.filter(item => item && typeof item === 'string');
|
|
12723
|
+
return (_result = result) != null && _result.length ? result : undefined;
|
|
12724
|
+
}
|
|
12725
|
+
|
|
12726
|
+
function normalizeNumber(value) {
|
|
12727
|
+
if (isNaN(+value)) return;
|
|
12728
|
+
return +value;
|
|
12729
|
+
}
|
|
12730
|
+
|
|
12667
12731
|
var frontmatter = /*#__PURE__*/Object.freeze({
|
|
12668
12732
|
__proto__: null,
|
|
12669
12733
|
name: name,
|
|
@@ -12679,7 +12743,7 @@ function createTransformHooks() {
|
|
|
12679
12743
|
};
|
|
12680
12744
|
}
|
|
12681
12745
|
|
|
12682
|
-
const plugins = [katex, prism
|
|
12746
|
+
const plugins = [frontmatter, katex, prism];
|
|
12683
12747
|
|
|
12684
12748
|
function cleanNode(node) {
|
|
12685
12749
|
if (node.type === 'heading') {
|
|
@@ -12885,7 +12949,7 @@ class Transformer {
|
|
|
12885
12949
|
|
|
12886
12950
|
const styles = [];
|
|
12887
12951
|
const scripts = [];
|
|
12888
|
-
(_keys = keys) != null ? _keys : keys =
|
|
12952
|
+
(_keys = keys) != null ? _keys : keys = this.plugins.map(plugin => plugin.name);
|
|
12889
12953
|
|
|
12890
12954
|
for (const assets of keys.map(key => this.assetsMap[key])) {
|
|
12891
12955
|
if (assets) {
|
|
@@ -12905,13 +12969,20 @@ class Transformer {
|
|
|
12905
12969
|
|
|
12906
12970
|
|
|
12907
12971
|
getUsedAssets(features) {
|
|
12908
|
-
|
|
12972
|
+
const keys = this.plugins.map(plugin => plugin.name).filter(name => features[name]);
|
|
12973
|
+
return this.getAssets(keys);
|
|
12909
12974
|
}
|
|
12910
12975
|
|
|
12911
12976
|
}
|
|
12912
12977
|
|
|
12978
|
+
const transformerVersions = {
|
|
12979
|
+
'markmap-lib': '0.13.6-alpha.3+3e26a91',
|
|
12980
|
+
d3: "6.7.0"
|
|
12981
|
+
};
|
|
12982
|
+
|
|
12913
12983
|
exports.Transformer = Transformer;
|
|
12914
12984
|
exports.builtInPlugins = plugins;
|
|
12915
12985
|
exports.fillTemplate = fillTemplate;
|
|
12986
|
+
exports.transformerVersions = transformerVersions;
|
|
12916
12987
|
|
|
12917
12988
|
}));
|