markmap-lib
Advanced tools
Comparing version 0.13.6-alpha.4 to 0.13.6-alpha.5
@@ -1,2 +0,2 @@ | ||
/*! markmap-lib v0.13.6-alpha.4+70ae484 | MIT License */ | ||
/*! markmap-lib v0.13.6-alpha.5+3a7e620 | MIT License */ | ||
import _extends$1 from '@babel/runtime/helpers/esm/extends'; | ||
@@ -178,3 +178,3 @@ import { Remarkable } from 'remarkable'; | ||
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"; | ||
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.6-alpha.4+70ae484"}`].map(src => ({ | ||
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.5"}`].map(src => ({ | ||
type: 'script', | ||
@@ -223,3 +223,3 @@ data: { | ||
versions: { | ||
katex: "0.15.3", | ||
katex: "0.16.0", | ||
webfontloader: "1.6.28" | ||
@@ -230,3 +230,3 @@ }, | ||
data: { | ||
src: `https://cdn.jsdelivr.net/npm/katex@${"0.15.3"}/dist/katex.min.js` | ||
src: `https://cdn.jsdelivr.net/npm/katex@${"0.16.0"}/dist/katex.min.js` | ||
} | ||
@@ -265,3 +265,3 @@ }], | ||
data: { | ||
href: `https://cdn.jsdelivr.net/npm/katex@${"0.15.3"}/dist/katex.min.css` | ||
href: `https://cdn.jsdelivr.net/npm/katex@${"0.16.0"}/dist/katex.min.css` | ||
} | ||
@@ -271,2 +271,15 @@ }] | ||
/** | ||
* Find NPM paths and resolve them to full URLs with the same package version as in this library. | ||
*/ | ||
function resolveNpmPaths(paths, name, version) { | ||
return paths.map(path => { | ||
if (typeof path === 'string' && path.startsWith(`${name}/`)) { | ||
return `https://cdn.jsdelivr.net/npm/${name}@${version}${path.slice(name.length)}`; | ||
} | ||
return path; | ||
}); | ||
} | ||
const name$2 = 'katex'; | ||
@@ -284,3 +297,3 @@ function transform$2(transformHooks) { | ||
}); | ||
transformHooks.transform.tap((_, context) => { | ||
transformHooks.beforeParse.tap((_, context) => { | ||
enableFeature = () => { | ||
@@ -290,2 +303,15 @@ context.features[name$2] = true; | ||
}); | ||
transformHooks.afterParse.tap((_, context) => { | ||
const { | ||
frontmatter | ||
} = context; | ||
if (frontmatter != null && frontmatter.markmap) { | ||
['extraJs', 'extraCss'].forEach(key => { | ||
if (frontmatter.markmap[key]) { | ||
frontmatter.markmap[key] = resolveNpmPaths(frontmatter.markmap[key], name$2, config$1.versions.katex); | ||
} | ||
}); | ||
} | ||
}); | ||
return { | ||
@@ -350,3 +376,3 @@ styles: config$1.styles, | ||
}); | ||
transformHooks.transform.tap((_, context) => { | ||
transformHooks.beforeParse.tap((_, context) => { | ||
enableFeature = () => { | ||
@@ -370,3 +396,3 @@ context.features[name$1] = true; | ||
function transform(transformHooks) { | ||
transformHooks.transform.tap((md, context) => { | ||
transformHooks.beforeParse.tap((md, context) => { | ||
const origParse = md.parse; | ||
@@ -441,3 +467,4 @@ md.parse = wrapFunction(origParse, { | ||
parser: new Hook(), | ||
transform: new Hook(), | ||
beforeParse: new Hook(), | ||
afterParse: new Hook(), | ||
htmltag: new Hook(), | ||
@@ -634,4 +661,5 @@ retransform: new Hook() | ||
}; | ||
this.hooks.transform.call(this.md, context); | ||
this.hooks.beforeParse.call(this.md, context); | ||
const tokens = this.md.parse(content, {}); | ||
this.hooks.afterParse.call(this.md, context); | ||
let root = this.buildTree(tokens); | ||
@@ -682,3 +710,3 @@ cleanNode(root); | ||
const transformerVersions = { | ||
'markmap-lib': '0.13.6-alpha.4+70ae484', | ||
'markmap-lib': '0.13.6-alpha.5+3a7e620', | ||
d3: "6.7.0" | ||
@@ -685,0 +713,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/*! markmap-lib v0.13.6-alpha.4+70ae484 | MIT License */ | ||
/*! markmap-lib v0.13.6-alpha.5+3a7e620 | MIT License */ | ||
'use strict'; | ||
@@ -188,3 +188,3 @@ | ||
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"; | ||
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.6-alpha.4+70ae484"}`].map(src => ({ | ||
const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.5"}`].map(src => ({ | ||
type: 'script', | ||
@@ -233,3 +233,3 @@ data: { | ||
versions: { | ||
katex: "0.15.3", | ||
katex: "0.16.0", | ||
webfontloader: "1.6.28" | ||
@@ -240,3 +240,3 @@ }, | ||
data: { | ||
src: `https://cdn.jsdelivr.net/npm/katex@${"0.15.3"}/dist/katex.min.js` | ||
src: `https://cdn.jsdelivr.net/npm/katex@${"0.16.0"}/dist/katex.min.js` | ||
} | ||
@@ -275,3 +275,3 @@ }], | ||
data: { | ||
href: `https://cdn.jsdelivr.net/npm/katex@${"0.15.3"}/dist/katex.min.css` | ||
href: `https://cdn.jsdelivr.net/npm/katex@${"0.16.0"}/dist/katex.min.css` | ||
} | ||
@@ -281,2 +281,15 @@ }] | ||
/** | ||
* Find NPM paths and resolve them to full URLs with the same package version as in this library. | ||
*/ | ||
function resolveNpmPaths(paths, name, version) { | ||
return paths.map(path => { | ||
if (typeof path === 'string' && path.startsWith(`${name}/`)) { | ||
return `https://cdn.jsdelivr.net/npm/${name}@${version}${path.slice(name.length)}`; | ||
} | ||
return path; | ||
}); | ||
} | ||
const name$2 = 'katex'; | ||
@@ -294,3 +307,3 @@ function transform$2(transformHooks) { | ||
}); | ||
transformHooks.transform.tap((_, context) => { | ||
transformHooks.beforeParse.tap((_, context) => { | ||
enableFeature = () => { | ||
@@ -300,2 +313,15 @@ context.features[name$2] = true; | ||
}); | ||
transformHooks.afterParse.tap((_, context) => { | ||
const { | ||
frontmatter | ||
} = context; | ||
if (frontmatter != null && frontmatter.markmap) { | ||
['extraJs', 'extraCss'].forEach(key => { | ||
if (frontmatter.markmap[key]) { | ||
frontmatter.markmap[key] = resolveNpmPaths(frontmatter.markmap[key], name$2, config$1.versions.katex); | ||
} | ||
}); | ||
} | ||
}); | ||
return { | ||
@@ -360,3 +386,3 @@ styles: config$1.styles, | ||
}); | ||
transformHooks.transform.tap((_, context) => { | ||
transformHooks.beforeParse.tap((_, context) => { | ||
enableFeature = () => { | ||
@@ -380,3 +406,3 @@ context.features[name$1] = true; | ||
function transform(transformHooks) { | ||
transformHooks.transform.tap((md, context) => { | ||
transformHooks.beforeParse.tap((md, context) => { | ||
const origParse = md.parse; | ||
@@ -451,3 +477,4 @@ md.parse = wrapFunction(origParse, { | ||
parser: new Hook(), | ||
transform: new Hook(), | ||
beforeParse: new Hook(), | ||
afterParse: new Hook(), | ||
htmltag: new Hook(), | ||
@@ -644,4 +671,5 @@ retransform: new Hook() | ||
}; | ||
this.hooks.transform.call(this.md, context); | ||
this.hooks.beforeParse.call(this.md, context); | ||
const tokens = this.md.parse(content, {}); | ||
this.hooks.afterParse.call(this.md, context); | ||
let root = this.buildTree(tokens); | ||
@@ -692,3 +720,3 @@ cleanNode(root); | ||
const transformerVersions = { | ||
'markmap-lib': '0.13.6-alpha.4+70ae484', | ||
'markmap-lib': '0.13.6-alpha.5+3a7e620', | ||
d3: "6.7.0" | ||
@@ -695,0 +723,0 @@ }; |
{ | ||
"name": "markmap-lib", | ||
"version": "0.13.6-alpha.4+70ae484", | ||
"version": "0.13.6-alpha.5+3a7e620", | ||
"description": "Visualize your Markdown as mindmaps with Markmap", | ||
@@ -46,12 +46,12 @@ "author": "Gerald <gera2ld@live.com>", | ||
"markmap-common": "^0.13.4", | ||
"markmap-view": "^0.13.6-alpha.4+70ae484", | ||
"markmap-view": "^0.13.5", | ||
"webfontloader": "^1.6.28" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.16.3", | ||
"@babel/runtime": "^7.18.9", | ||
"js-yaml": "^4.1.0", | ||
"katex": "^0.15.1", | ||
"prismjs": "^1.25.0", | ||
"katex": "^0.16.0", | ||
"prismjs": "^1.28.0", | ||
"remarkable": "^2.0.1", | ||
"remarkable-katex": "^1.1.8" | ||
"remarkable-katex": "^1.2.1" | ||
}, | ||
@@ -61,3 +61,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "70ae4840c81db3ed8f7a143a11ce1cd6be9b4dbf" | ||
"gitHead": "3a7e62012256a490d0acbb93d486773e620f7bac" | ||
} |
@@ -10,6 +10,10 @@ import type { Remarkable } from 'remarkable'; | ||
/** | ||
* Tapped every time when Markdown content is transformed. | ||
* Tapped every time before Markdown content is parsed. | ||
*/ | ||
transform: Hook<[md: Remarkable, context: ITransformContext]>; | ||
beforeParse: Hook<[md: Remarkable, context: ITransformContext]>; | ||
/** | ||
* Tapped every time after Markdown content is parsed. | ||
*/ | ||
afterParse: Hook<[md: Remarkable, context: ITransformContext]>; | ||
/** | ||
* Tapped when Remarkable renders an HTML tag in Markdown. | ||
@@ -19,4 +23,3 @@ */ | ||
/** | ||
* Indicate that the last transformation is not complete for reasons like | ||
* lack of resources and is called when it is ready for a new transformation. | ||
* Used in autoloader to force rerender when resource is loaded. | ||
*/ | ||
@@ -23,0 +26,0 @@ retransform: Hook<[]>; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
478595
12779
+ Addedkatex@0.16.21(transitive)
- Removedkatex@0.15.6(transitive)
Updated@babel/runtime@^7.18.9
Updatedkatex@^0.16.0
Updatedprismjs@^1.28.0
Updatedremarkable-katex@^1.2.1