markmap-render 0.15.9-alpha.14
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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +53 -0
- package/dist/index.mjs +53 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Gerald
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# markmap-render
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Render a markmap as an interactive HTML.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
$ npm install markmap-render
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
👉 [Read the documentation](https://markmap.js.org/docs) for more detail.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IAssets, IMarkmapOptions, IPureNode, JSItem, UrlBuilder } from 'markmap-common';
|
|
2
|
+
import { IMarkmapJSONOptions } from 'markmap-view';
|
|
3
|
+
export declare const template: string;
|
|
4
|
+
export declare const baseJsPaths: string[];
|
|
5
|
+
export declare function fillTemplate(root: IPureNode | null, assets: IAssets, extra?: {
|
|
6
|
+
baseJs?: JSItem[];
|
|
7
|
+
jsonOptions?: IMarkmapJSONOptions;
|
|
8
|
+
getOptions?: (jsonOptions: IMarkmapJSONOptions) => Partial<IMarkmapOptions>;
|
|
9
|
+
urlBuilder?: UrlBuilder;
|
|
10
|
+
}): string;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const markmapCommon = require("markmap-common");
|
|
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';
|
|
5
|
+
const baseJsPaths = [
|
|
6
|
+
`d3@${process.env.D3_VERSION}/dist/d3.min.js`,
|
|
7
|
+
`markmap-view@${process.env.VIEW_VERSION}/dist/browser/index.js`
|
|
8
|
+
];
|
|
9
|
+
function fillTemplate(root, assets, extra) {
|
|
10
|
+
extra = {
|
|
11
|
+
...extra
|
|
12
|
+
};
|
|
13
|
+
const urlBuilder = extra.urlBuilder ?? markmapCommon.urlBuilder;
|
|
14
|
+
extra.baseJs ?? (extra.baseJs = baseJsPaths.map((path) => urlBuilder.getFullUrl(path)).map((path) => markmapCommon.buildJSItem(path)));
|
|
15
|
+
const { scripts, styles } = assets;
|
|
16
|
+
const cssList = [...styles ? markmapCommon.persistCSS(styles) : []];
|
|
17
|
+
const context = {
|
|
18
|
+
getMarkmap: () => window.markmap,
|
|
19
|
+
getOptions: extra.getOptions,
|
|
20
|
+
jsonOptions: extra.jsonOptions,
|
|
21
|
+
root
|
|
22
|
+
};
|
|
23
|
+
const jsList = [
|
|
24
|
+
...markmapCommon.persistJS(
|
|
25
|
+
[
|
|
26
|
+
...extra.baseJs,
|
|
27
|
+
...scripts || [],
|
|
28
|
+
{
|
|
29
|
+
type: "iife",
|
|
30
|
+
data: {
|
|
31
|
+
fn: (getMarkmap, getOptions, root2, jsonOptions) => {
|
|
32
|
+
const markmap = getMarkmap();
|
|
33
|
+
window.mm = markmap.Markmap.create(
|
|
34
|
+
"svg#mindmap",
|
|
35
|
+
(getOptions || markmap.deriveOptions)(jsonOptions),
|
|
36
|
+
root2
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
getParams: ({ getMarkmap, getOptions, root: root2, jsonOptions }) => {
|
|
40
|
+
return [getMarkmap, getOptions, root2, jsonOptions];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
context
|
|
46
|
+
)
|
|
47
|
+
];
|
|
48
|
+
const html = template.replace("<!--CSS-->", () => cssList.join("")).replace("<!--JS-->", () => jsList.join(""));
|
|
49
|
+
return html;
|
|
50
|
+
}
|
|
51
|
+
exports.baseJsPaths = baseJsPaths;
|
|
52
|
+
exports.fillTemplate = fillTemplate;
|
|
53
|
+
exports.template = template;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { urlBuilder, buildJSItem, persistCSS, persistJS } from "markmap-common";
|
|
2
|
+
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';
|
|
3
|
+
const baseJsPaths = [
|
|
4
|
+
`d3@${process.env.D3_VERSION}/dist/d3.min.js`,
|
|
5
|
+
`markmap-view@${process.env.VIEW_VERSION}/dist/browser/index.js`
|
|
6
|
+
];
|
|
7
|
+
function fillTemplate(root, assets, extra) {
|
|
8
|
+
extra = {
|
|
9
|
+
...extra
|
|
10
|
+
};
|
|
11
|
+
const urlBuilder$1 = extra.urlBuilder ?? urlBuilder;
|
|
12
|
+
extra.baseJs ?? (extra.baseJs = baseJsPaths.map((path) => urlBuilder$1.getFullUrl(path)).map((path) => buildJSItem(path)));
|
|
13
|
+
const { scripts, styles } = assets;
|
|
14
|
+
const cssList = [...styles ? persistCSS(styles) : []];
|
|
15
|
+
const context = {
|
|
16
|
+
getMarkmap: () => window.markmap,
|
|
17
|
+
getOptions: extra.getOptions,
|
|
18
|
+
jsonOptions: extra.jsonOptions,
|
|
19
|
+
root
|
|
20
|
+
};
|
|
21
|
+
const jsList = [
|
|
22
|
+
...persistJS(
|
|
23
|
+
[
|
|
24
|
+
...extra.baseJs,
|
|
25
|
+
...scripts || [],
|
|
26
|
+
{
|
|
27
|
+
type: "iife",
|
|
28
|
+
data: {
|
|
29
|
+
fn: (getMarkmap, getOptions, root2, jsonOptions) => {
|
|
30
|
+
const markmap = getMarkmap();
|
|
31
|
+
window.mm = markmap.Markmap.create(
|
|
32
|
+
"svg#mindmap",
|
|
33
|
+
(getOptions || markmap.deriveOptions)(jsonOptions),
|
|
34
|
+
root2
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
getParams: ({ getMarkmap, getOptions, root: root2, jsonOptions }) => {
|
|
38
|
+
return [getMarkmap, getOptions, root2, jsonOptions];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
context
|
|
44
|
+
)
|
|
45
|
+
];
|
|
46
|
+
const html = template.replace("<!--CSS-->", () => cssList.join("")).replace("<!--JS-->", () => jsList.join(""));
|
|
47
|
+
return html;
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
baseJsPaths,
|
|
51
|
+
fillTemplate,
|
|
52
|
+
template
|
|
53
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "markmap-render",
|
|
3
|
+
"version": "0.15.9-alpha.14+fa8173f",
|
|
4
|
+
"description": "Visualize your Markdown as mindmaps with Markmap",
|
|
5
|
+
"author": "Gerald <gera2ld@live.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "del-cli dist",
|
|
9
|
+
"build:types": "tsc",
|
|
10
|
+
"build:js": "vite build",
|
|
11
|
+
"build": "run-s clean build:*"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public",
|
|
15
|
+
"registry": "https://registry.npmjs.org/"
|
|
16
|
+
},
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"main": "dist/index.js",
|
|
19
|
+
"module": "dist/index.mjs",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"require": "./dist/index.js",
|
|
24
|
+
"default": "./dist/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"keywords": [
|
|
33
|
+
"markdown",
|
|
34
|
+
"markmap",
|
|
35
|
+
"mindmap"
|
|
36
|
+
],
|
|
37
|
+
"homepage": "https://github.com/markmap/markmap/packages/markmap-render#readme",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/markmap/markmap.git"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/markmap/markmap/issues"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"markmap-common": "0.15.9-alpha.14+fa8173f",
|
|
47
|
+
"markmap-view": "0.15.9-alpha.14+fa8173f"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@babel/runtime": "^7.22.6"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"markmap-common": "*",
|
|
54
|
+
"markmap-view": "*"
|
|
55
|
+
},
|
|
56
|
+
"gitHead": "fa8173fbb9d5b30e669da11497f24123e5ead511"
|
|
57
|
+
}
|