markmap-lib
Advanced tools
Comparing version 0.14.5-alpha.15 to 0.14.5-alpha.16
@@ -1,2 +0,2 @@ | ||
/*! markmap-lib v0.14.5-alpha.15+1fe26c8 | MIT License */ | ||
/*! markmap-lib v0.14.5-alpha.16+33e8294 | MIT License */ | ||
'use strict'; | ||
@@ -12,4 +12,4 @@ | ||
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 baseJsPaths = [`d3@${"6.2.0"}/dist/d3.min.js`, `markmap-view@${"0.14.5-alpha.15+1fe26c8"}/dist/browser/index.js`]; | ||
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 baseJsPaths = [`d3@${"6.2.0"}/dist/d3.min.js`, `markmap-view@${"0.14.5-alpha.16+33e8294"}/dist/browser/index.js`]; | ||
function fillTemplate(root, assets, extra) { | ||
@@ -58,4 +58,4 @@ var _extra, _extra$baseJs; | ||
versions: { | ||
katex: "0.16.0", | ||
webfontloader: "1.6.28" | ||
katex: "0.16.0" , | ||
webfontloader: "1.6.28" | ||
}, | ||
@@ -137,3 +137,3 @@ preloadScripts, | ||
versions: { | ||
prismjs: "1.28.0" | ||
prismjs: "1.28.0" | ||
}, | ||
@@ -239,6 +239,8 @@ preloadScripts, | ||
} = context; | ||
if (frontmatter != null && frontmatter.markmap) { | ||
const markmap = frontmatter == null ? void 0 : frontmatter.markmap; | ||
if (markmap) { | ||
['extraJs', 'extraCss'].forEach(key => { | ||
if (frontmatter.markmap[key]) { | ||
frontmatter.markmap[key] = frontmatter.markmap[key].map(path => { | ||
const value = markmap[key]; | ||
if (value) { | ||
markmap[key] = value.map(path => { | ||
if (path.startsWith('npm:')) { | ||
@@ -291,5 +293,3 @@ return markmapCommon.getFullUrl(path.slice(4)); | ||
} | ||
if (node.children.length === 0) { | ||
delete node.children; | ||
} else { | ||
if (node.children.length > 0) { | ||
node.children.forEach(child => cleanNode(child)); | ||
@@ -302,5 +302,4 @@ if (node.children.length === 1 && !node.children[0].content) { | ||
function resetDepth(node, depth = 0) { | ||
var _node$children; | ||
node.depth = depth; | ||
(_node$children = node.children) == null ? void 0 : _node$children.forEach(child => { | ||
node.children.forEach(child => { | ||
resetDepth(child, depth + 1); | ||
@@ -393,6 +392,9 @@ }); | ||
const revoke = this.hooks.htmltag.tap(ctx => { | ||
const comment = ctx.result.match(/^<!--([\s\S]*?)-->$/); | ||
var _ctx$result; | ||
const comment = (_ctx$result = ctx.result) == null ? void 0 : _ctx$result.match(/^<!--([\s\S]*?)-->$/); | ||
const data = comment == null ? void 0 : comment[1].trim().split(' '); | ||
if (data[0] === 'fold') { | ||
current.payload.fold = ['all', 'recursively'].includes(data[1]) ? 2 : 1; | ||
if ((data == null ? void 0 : data[0]) === 'fold') { | ||
current.payload = _extends({}, current.payload, { | ||
fold: ['all', 'recursively'].includes(data[1]) ? 2 : 1 | ||
}); | ||
ctx.result = ''; | ||
@@ -468,3 +470,3 @@ } | ||
const transformerVersions = { | ||
'markmap-lib': '0.14.5-alpha.15+1fe26c8', | ||
'markmap-lib': '0.14.5-alpha.16+33e8294', | ||
d3: "6.2.0" | ||
@@ -471,0 +473,0 @@ }; |
{ | ||
"name": "markmap-lib", | ||
"version": "0.14.5-alpha.15+1fe26c8", | ||
"version": "0.14.5-alpha.16+33e8294", | ||
"description": "Visualize your Markdown as mindmaps with Markmap", | ||
@@ -50,4 +50,4 @@ "author": "Gerald <gera2ld@live.com>", | ||
"@types/remarkable": "^2.0.3", | ||
"markmap-common": "0.14.5-alpha.15+1fe26c8", | ||
"markmap-view": "0.14.5-alpha.15+1fe26c8", | ||
"markmap-common": "0.14.5-alpha.16+33e8294", | ||
"markmap-view": "0.14.5-alpha.16+33e8294", | ||
"webfontloader": "^1.6.28" | ||
@@ -66,3 +66,3 @@ }, | ||
}, | ||
"gitHead": "1fe26c8234296e2188e466c7b9dbf3b7e171857d" | ||
"gitHead": "33e8294050d7438f6cdadd5bf06a665560585195" | ||
} |
@@ -6,3 +6,3 @@ export * from './types'; | ||
'markmap-lib': string; | ||
d3: string; | ||
d3: string | undefined; | ||
}; |
@@ -1,5 +0,5 @@ | ||
import { JSItem, INode, IMarkmapOptions, IMarkmapJSONOptions } from 'markmap-common'; | ||
import { JSItem, IMarkmapOptions, IMarkmapJSONOptions, IPureNode } from 'markmap-common'; | ||
import { IAssets } from './types'; | ||
export declare const baseJsPaths: string[]; | ||
export declare function fillTemplate(root: INode | undefined, assets: IAssets, extra?: { | ||
export declare function fillTemplate(root: IPureNode | null, assets: IAssets, extra?: { | ||
baseJs?: JSItem[]; | ||
@@ -6,0 +6,0 @@ jsonOptions?: IMarkmapJSONOptions; |
import { Remarkable } from 'remarkable'; | ||
import { INode } from 'markmap-common'; | ||
import { IPureNode } from 'markmap-common'; | ||
import { ITransformResult, ITransformPlugin, IAssets, ITransformHooks, IFeatures } from './types'; | ||
@@ -12,3 +12,3 @@ import { plugins as builtInPlugins } from './plugins'; | ||
constructor(plugins?: Array<ITransformPlugin | (() => ITransformPlugin)>); | ||
buildTree(tokens: Remarkable.Token[]): INode; | ||
buildTree(tokens: Remarkable.Token[]): IPureNode; | ||
transform(content: string): ITransformResult; | ||
@@ -15,0 +15,0 @@ /** |
import type { Remarkable } from 'remarkable'; | ||
import { CSSItem, JSItem, INode, IWrapContext, Hook, IMarkmapJSONOptions } from 'markmap-common'; | ||
import { CSSItem, JSItem, IPureNode, IWrapContext, Hook, IMarkmapJSONOptions } from 'markmap-common'; | ||
type Htmltag = Remarkable.Rule<Remarkable.HtmlTagToken, string>; | ||
@@ -54,3 +54,3 @@ export interface ITransformHooks { | ||
export interface ITransformResult extends ITransformContext { | ||
root: INode; | ||
root: IPureNode; | ||
} | ||
@@ -57,0 +57,0 @@ export interface ITransformPlugin { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
657168
22571