markmap-lib
Advanced tools
Comparing version 0.11.1 to 0.11.2
@@ -1,2 +0,2 @@ | ||
/*! markmap-lib v0.11.1 | MIT License */ | ||
/*! markmap-lib v0.11.2 | MIT License */ | ||
import { persistCSS, persistJS, wrapFunction, Hook } from 'markmap-common'; | ||
@@ -10,3 +10,3 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
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 baseJs = [`https://cdn.jsdelivr.net/npm/d3@${"6.3.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.2.1"}`].map(src => ({ | ||
const baseJs = [`https://cdn.jsdelivr.net/npm/d3@${"6.3.1"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.2.2"}`].map(src => ({ | ||
type: 'script', | ||
@@ -17,10 +17,11 @@ data: { | ||
})); | ||
function fillTemplate(data, opts) { | ||
function fillTemplate(data, assets, getOptions) { | ||
const { | ||
scripts, | ||
styles | ||
} = opts; | ||
} = assets; | ||
const cssList = [...(styles ? persistCSS(styles) : [])]; | ||
const context = { | ||
getMarkmap: () => window.markmap, | ||
getOptions, | ||
data | ||
@@ -31,13 +32,14 @@ }; | ||
data: { | ||
fn: (getMarkmap, data) => { | ||
fn: (getMarkmap, getOptions, data) => { | ||
const { | ||
Markmap | ||
} = getMarkmap(); | ||
window.mm = Markmap.create('svg#mindmap', null, data); | ||
window.mm = Markmap.create('svg#mindmap', getOptions == null ? void 0 : getOptions(), data); | ||
}, | ||
getParams: ({ | ||
getMarkmap, | ||
getOptions, | ||
data | ||
}) => { | ||
return [getMarkmap, data]; | ||
return [getMarkmap, getOptions, data]; | ||
} | ||
@@ -129,3 +131,3 @@ } | ||
data: { | ||
href: `https://cdn.jsdelivr.net/npm/prismjs@${"1.22.0"}/themes/prism.css` | ||
href: `https://cdn.jsdelivr.net/npm/prismjs@${"1.23.0"}/themes/prism.css` | ||
} | ||
@@ -132,0 +134,0 @@ }] |
@@ -1,2 +0,2 @@ | ||
/*! markmap-lib v0.11.1 | MIT License */ | ||
/*! markmap-lib v0.11.2 | MIT License */ | ||
'use strict'; | ||
@@ -19,3 +19,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 baseJs = [`https://cdn.jsdelivr.net/npm/d3@${"6.3.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.2.1"}`].map(src => ({ | ||
const baseJs = [`https://cdn.jsdelivr.net/npm/d3@${"6.3.1"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.2.2"}`].map(src => ({ | ||
type: 'script', | ||
@@ -26,10 +26,11 @@ data: { | ||
})); | ||
function fillTemplate(data, opts) { | ||
function fillTemplate(data, assets, getOptions) { | ||
const { | ||
scripts, | ||
styles | ||
} = opts; | ||
} = assets; | ||
const cssList = [...(styles ? markmapCommon.persistCSS(styles) : [])]; | ||
const context = { | ||
getMarkmap: () => window.markmap, | ||
getOptions, | ||
data | ||
@@ -40,13 +41,14 @@ }; | ||
data: { | ||
fn: (getMarkmap, data) => { | ||
fn: (getMarkmap, getOptions, data) => { | ||
const { | ||
Markmap | ||
} = getMarkmap(); | ||
window.mm = Markmap.create('svg#mindmap', null, data); | ||
window.mm = Markmap.create('svg#mindmap', getOptions == null ? void 0 : getOptions(), data); | ||
}, | ||
getParams: ({ | ||
getMarkmap, | ||
getOptions, | ||
data | ||
}) => { | ||
return [getMarkmap, data]; | ||
return [getMarkmap, getOptions, data]; | ||
} | ||
@@ -138,3 +140,3 @@ } | ||
data: { | ||
href: `https://cdn.jsdelivr.net/npm/prismjs@${"1.22.0"}/themes/prism.css` | ||
href: `https://cdn.jsdelivr.net/npm/prismjs@${"1.23.0"}/themes/prism.css` | ||
} | ||
@@ -141,0 +143,0 @@ }] |
{ | ||
"name": "markmap-lib", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "Visualize your Markdown as mindmaps with Markmap", | ||
@@ -41,3 +41,3 @@ "author": "Gerald <gera2ld@live.com>", | ||
"devDependencies": { | ||
"markmap-view": "^0.2.1" | ||
"markmap-view": "^0.2.2" | ||
}, | ||
@@ -47,3 +47,3 @@ "dependencies": { | ||
"katex": "^0.12.0", | ||
"markmap-common": "^0.1.2", | ||
"markmap-common": "^0.1.3", | ||
"prismjs": "^1.21.0", | ||
@@ -53,3 +53,3 @@ "remarkable": "^2.0.0", | ||
}, | ||
"gitHead": "ba28b32d3697c1495bfede73910f589937fa63e4" | ||
"gitHead": "cb2ed0a25207e2617bb8b4d3735d61d4b5392560" | ||
} |
import { INode } from 'markmap-common'; | ||
import { IAssets } from './types'; | ||
export declare function fillTemplate(data: INode | undefined, opts: IAssets): string; | ||
export declare function fillTemplate(data: INode | undefined, assets: IAssets, getOptions?: () => any): string; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
308720
8698
Updatedmarkmap-common@^0.1.3