markmap-lib 0.13.5 → 0.13.6-alpha.4

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/index.esm.js CHANGED
@@ -1,21 +1,188 @@
1
- /*! markmap-lib v0.13.5 | MIT License */
2
- import _extends from '@babel/runtime/helpers/esm/extends';
3
- import { persistCSS, persistJS, wrapFunction, Hook } from 'markmap-common';
1
+ /*! markmap-lib v0.13.6-alpha.4+70ae484 | MIT License */
2
+ import _extends$1 from '@babel/runtime/helpers/esm/extends';
4
3
  import { Remarkable } from 'remarkable';
5
4
  import remarkableKatex from 'remarkable-katex';
6
5
  import Prism from 'prismjs';
7
6
  import loadLanguages from 'prismjs/components/';
8
7
  import yaml from 'js-yaml';
9
8
 
9
+ /*! markmap-common v0.13.4 | MIT License */
10
+ class Hook {
11
+ constructor() {
12
+ this.listeners = [];
13
+ }
14
+
15
+ tap(fn) {
16
+ this.listeners.push(fn);
17
+ return () => this.revoke(fn);
18
+ }
19
+
20
+ revoke(fn) {
21
+ const i = this.listeners.indexOf(fn);
22
+ if (i >= 0) this.listeners.splice(i, 1);
23
+ }
24
+
25
+ revokeAll() {
26
+ this.listeners.splice(0);
27
+ }
28
+
29
+ call(...args) {
30
+ for (const fn of this.listeners) {
31
+ fn(...args);
32
+ }
33
+ }
34
+
35
+ }
36
+
37
+ function _extends() {
38
+ _extends = Object.assign || function (target) {
39
+ for (var i = 1; i < arguments.length; i++) {
40
+ var source = arguments[i];
41
+
42
+ for (var key in source) {
43
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
44
+ target[key] = source[key];
45
+ }
46
+ }
47
+ }
48
+
49
+ return target;
50
+ };
51
+
52
+ return _extends.apply(this, arguments);
53
+ }
54
+
55
+ function _objectWithoutPropertiesLoose(source, excluded) {
56
+ if (source == null) return {};
57
+ var target = {};
58
+ var sourceKeys = Object.keys(source);
59
+ var key, i;
60
+
61
+ for (i = 0; i < sourceKeys.length; i++) {
62
+ key = sourceKeys[i];
63
+ if (excluded.indexOf(key) >= 0) continue;
64
+ target[key] = source[key];
65
+ }
66
+
67
+ return target;
68
+ }
69
+
70
+ const _excluded = ["textContent"];
71
+
72
+ function escapeHtml(html) {
73
+ return html.replace(/[&<"]/g, m => ({
74
+ '&': '&amp;',
75
+ '<': '&lt;',
76
+ '"': '&quot;'
77
+ })[m]);
78
+ }
79
+
80
+ function escapeScript(content) {
81
+ return content.replace(/<(\/script>)/g, '\\x3c$2');
82
+ }
83
+
84
+ function htmlOpen(tagName, attrs) {
85
+ const attrStr = attrs ? Object.entries(attrs).map(([key, value]) => {
86
+ if (value == null || value === false) return;
87
+ key = ` ${escapeHtml(key)}`;
88
+ if (value === true) return key;
89
+ return `${key}="${escapeHtml(value)}"`;
90
+ }).filter(Boolean).join('') : '';
91
+ return `<${tagName}${attrStr}>`;
92
+ }
93
+
94
+ function htmlClose(tagName) {
95
+ return `</${tagName}>`;
96
+ }
97
+
98
+ function wrapHtml(tagName, content, attrs) {
99
+ if (content == null) return htmlOpen(tagName, attrs);
100
+ return htmlOpen(tagName, attrs) + (content || '') + htmlClose(tagName);
101
+ }
102
+
103
+ function buildCode(fn, args) {
104
+ const params = args.map(arg => {
105
+ if (typeof arg === 'function') return arg.toString();
106
+ return JSON.stringify(arg != null ? arg : null);
107
+ }).join(',');
108
+ return `(${fn.toString()})(${params})`;
109
+ }
110
+
111
+ function persistJS(items, context) {
112
+ return items.map(item => {
113
+ if (item.type === 'script') {
114
+ const _item$data = item.data,
115
+ {
116
+ textContent
117
+ } = _item$data,
118
+ rest = _objectWithoutPropertiesLoose(_item$data, _excluded);
119
+
120
+ return wrapHtml('script', textContent || '', rest);
121
+ }
122
+
123
+ if (item.type === 'iife') {
124
+ const {
125
+ fn,
126
+ getParams
127
+ } = item.data;
128
+ return wrapHtml('script', escapeScript(buildCode(fn, (getParams == null ? void 0 : getParams(context)) || [])));
129
+ }
130
+
131
+ return '';
132
+ });
133
+ }
134
+
135
+ function persistCSS(items) {
136
+ return items.map(item => {
137
+ if (item.type === 'stylesheet') {
138
+ return wrapHtml('link', null, _extends({
139
+ rel: 'stylesheet'
140
+ }, item.data));
141
+ }
142
+ /* else if (item.type === 'style') */
143
+
144
+
145
+ return wrapHtml('style', item.data);
146
+ });
147
+ }
148
+
149
+ Math.random().toString(36).slice(2, 8);
150
+
151
+ function wrapFunction(fn, {
152
+ before,
153
+ after
154
+ }) {
155
+ return function wrapped(...args) {
156
+ const ctx = {
157
+ args,
158
+ thisObj: this
159
+ };
160
+
161
+ try {
162
+ if (before) before(ctx);
163
+ } catch (_unused) {// ignore
164
+ }
165
+
166
+ ctx.result = fn.apply(ctx.thisObj, ctx.args);
167
+
168
+ try {
169
+ if (after) after(ctx);
170
+ } catch (_unused2) {// ignore
171
+ }
172
+
173
+ return ctx.result;
174
+ };
175
+ }
176
+
10
177
  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";
11
- const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.5"}`].map(src => ({
178
+ 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 => ({
12
179
  type: 'script',
13
180
  data: {
14
181
  src
15
182
  }
16
183
  }));
17
184
  function fillTemplate(root, assets, extra) {
18
- extra = _extends({
185
+ extra = _extends$1({
19
186
  baseJs: BASE_JS
20
187
  }, extra);
21
188
  const {
@@ -51,6 +218,10 @@ function fillTemplate(root, assets, extra) {
51
218
  }
52
219
 
53
220
  var config$1 = {
221
+ versions: {
222
+ katex: "0.15.3",
223
+ webfontloader: "1.6.28"
224
+ },
54
225
  preloadScripts: [{
55
226
  type: 'script',
56
227
  data: {
@@ -124,6 +295,9 @@ transform: transform$2
124
295
  });
125
296
 
126
297
  var config = {
298
+ versions: {
299
+ prismjs: "1.28.0"
300
+ },
127
301
  preloadScripts: [{
128
302
  type: 'script',
129
303
  data: {
@@ -194,13 +368,21 @@ function transform(transformHooks) {
194
368
  const endOffset = content.indexOf('\n---\n');
195
369
  if (endOffset < 0) return;
196
370
  const raw = content.slice(4, endOffset);
371
+ let frontmatter;
197
372
 
198
373
  try {
199
- context.frontmatter = yaml.load(raw);
374
+ var _frontmatter;
375
+
376
+ frontmatter = yaml.load(raw);
377
+
378
+ if ((_frontmatter = frontmatter) != null && _frontmatter.markmap) {
379
+ frontmatter.markmap = normalizeMarkmapJsonOptions(frontmatter.markmap);
380
+ }
200
381
  } catch (_unused) {
201
382
  return;
202
383
  }
203
384
 
385
+ context.frontmatter = frontmatter;
204
386
  const offset = endOffset + 5;
205
387
  ctx.args[0] = content.slice(offset);
206
388
  },
@@ -214,6 +396,30 @@ function transform(transformHooks) {
214
396
  return {};
215
397
  }
216
398
 
399
+ function normalizeMarkmapJsonOptions(options) {
400
+ if (!options) return;
401
+ ['color', 'extraJs', 'extraCss'].forEach(key => {
402
+ if (options[key] != null) options[key] = normalizeStringArray(options[key]);
403
+ });
404
+ ['duration', 'maxWidth', 'initialExpandLevel'].forEach(key => {
405
+ if (options[key] != null) options[key] = normalizeNumber(options[key]);
406
+ });
407
+ return options;
408
+ }
409
+
410
+ function normalizeStringArray(value) {
411
+ var _result;
412
+
413
+ let result;
414
+ if (typeof value === 'string') result = [value];else if (Array.isArray(value)) result = value.filter(item => item && typeof item === 'string');
415
+ return (_result = result) != null && _result.length ? result : undefined;
416
+ }
417
+
418
+ function normalizeNumber(value) {
419
+ if (isNaN(+value)) return;
420
+ return +value;
421
+ }
422
+
217
423
  var frontmatter = /*#__PURE__*/Object.freeze({
218
424
  __proto__: null,
219
425
  name: name,
@@ -229,7 +435,7 @@ function createTransformHooks() {
229
435
  };
230
436
  }
231
437
 
232
- const plugins = [katex, prism, frontmatter];
438
+ const plugins = [frontmatter, katex, prism];
233
439
 
234
440
  function cleanNode(node) {
235
441
  if (node.type === 'heading') {
@@ -243,7 +449,7 @@ function cleanNode(node) {
243
449
  if (['paragraph', 'fence'].includes(item.type)) {
244
450
  if (!node.content) {
245
451
  node.content = item.content;
246
- node.payload = _extends({}, node.payload, item.payload);
452
+ node.payload = _extends$1({}, node.payload, item.payload);
247
453
  }
248
454
 
249
455
  return false;
@@ -261,7 +467,7 @@ function cleanNode(node) {
261
467
  let index = (_node$payload$startIn = (_node$payload2 = node.payload) == null ? void 0 : _node$payload2.startIndex) != null ? _node$payload$startIn : 1;
262
468
  node.children.forEach(item => {
263
469
  if (item.type === 'list_item') {
264
- item.payload = _extends({}, item.payload, {
470
+ item.payload = _extends$1({}, item.payload, {
265
471
  index
266
472
  });
267
473
  index += 1;
@@ -421,7 +627,7 @@ class Transformer {
421
627
  cleanNode(root);
422
628
  if (((_root$children = root.children) == null ? void 0 : _root$children.length) === 1) root = root.children[0];
423
629
  resetDepth(root);
424
- return _extends({}, context, {
630
+ return _extends$1({}, context, {
425
631
  root
426
632
  });
427
633
  }
@@ -435,7 +641,7 @@ class Transformer {
435
641
 
436
642
  const styles = [];
437
643
  const scripts = [];
438
- (_keys = keys) != null ? _keys : keys = Object.keys(this.assetsMap);
644
+ (_keys = keys) != null ? _keys : keys = this.plugins.map(plugin => plugin.name);
439
645
 
440
646
  for (const assets of keys.map(key => this.assetsMap[key])) {
441
647
  if (assets) {
@@ -455,9 +661,15 @@ class Transformer {
455
661
 
456
662
 
457
663
  getUsedAssets(features) {
458
- return this.getAssets(Object.keys(features).filter(key => features[key]));
664
+ const keys = this.plugins.map(plugin => plugin.name).filter(name => features[name]);
665
+ return this.getAssets(keys);
459
666
  }
460
667
 
461
668
  }
462
669
 
463
- export { Transformer, plugins as builtInPlugins, fillTemplate };
670
+ const transformerVersions = {
671
+ 'markmap-lib': '0.13.6-alpha.4+70ae484',
672
+ d3: "6.7.0"
673
+ };
674
+
675
+ export { Transformer, plugins as builtInPlugins, fillTemplate, transformerVersions };
package/dist/index.js CHANGED
@@ -1,8 +1,7 @@
1
- /*! markmap-lib v0.13.5 | MIT License */
1
+ /*! markmap-lib v0.13.6-alpha.4+70ae484 | MIT License */
2
2
  'use strict';
3
3
 
4
- var _extends = require('@babel/runtime/helpers/extends');
5
- var markmapCommon = require('markmap-common');
4
+ var _extends$1 = require('@babel/runtime/helpers/extends');
6
5
  var remarkable = require('remarkable');
7
6
  var remarkableKatex = require('remarkable-katex');
8
7
  var Prism = require('prismjs');
@@ -11,14 +10,182 @@ var yaml = require('js-yaml');
11
10
 
12
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
13
12
 
14
- var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
13
+ var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends$1);
15
14
  var remarkableKatex__default = /*#__PURE__*/_interopDefaultLegacy(remarkableKatex);
16
15
  var Prism__default = /*#__PURE__*/_interopDefaultLegacy(Prism);
17
16
  var loadLanguages__default = /*#__PURE__*/_interopDefaultLegacy(loadLanguages);
18
17
  var yaml__default = /*#__PURE__*/_interopDefaultLegacy(yaml);
19
18
 
19
+ /*! markmap-common v0.13.4 | MIT License */
20
+ class Hook {
21
+ constructor() {
22
+ this.listeners = [];
23
+ }
24
+
25
+ tap(fn) {
26
+ this.listeners.push(fn);
27
+ return () => this.revoke(fn);
28
+ }
29
+
30
+ revoke(fn) {
31
+ const i = this.listeners.indexOf(fn);
32
+ if (i >= 0) this.listeners.splice(i, 1);
33
+ }
34
+
35
+ revokeAll() {
36
+ this.listeners.splice(0);
37
+ }
38
+
39
+ call(...args) {
40
+ for (const fn of this.listeners) {
41
+ fn(...args);
42
+ }
43
+ }
44
+
45
+ }
46
+
47
+ function _extends() {
48
+ _extends = Object.assign || function (target) {
49
+ for (var i = 1; i < arguments.length; i++) {
50
+ var source = arguments[i];
51
+
52
+ for (var key in source) {
53
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
54
+ target[key] = source[key];
55
+ }
56
+ }
57
+ }
58
+
59
+ return target;
60
+ };
61
+
62
+ return _extends.apply(this, arguments);
63
+ }
64
+
65
+ function _objectWithoutPropertiesLoose(source, excluded) {
66
+ if (source == null) return {};
67
+ var target = {};
68
+ var sourceKeys = Object.keys(source);
69
+ var key, i;
70
+
71
+ for (i = 0; i < sourceKeys.length; i++) {
72
+ key = sourceKeys[i];
73
+ if (excluded.indexOf(key) >= 0) continue;
74
+ target[key] = source[key];
75
+ }
76
+
77
+ return target;
78
+ }
79
+
80
+ const _excluded = ["textContent"];
81
+
82
+ function escapeHtml(html) {
83
+ return html.replace(/[&<"]/g, m => ({
84
+ '&': '&amp;',
85
+ '<': '&lt;',
86
+ '"': '&quot;'
87
+ })[m]);
88
+ }
89
+
90
+ function escapeScript(content) {
91
+ return content.replace(/<(\/script>)/g, '\\x3c$2');
92
+ }
93
+
94
+ function htmlOpen(tagName, attrs) {
95
+ const attrStr = attrs ? Object.entries(attrs).map(([key, value]) => {
96
+ if (value == null || value === false) return;
97
+ key = ` ${escapeHtml(key)}`;
98
+ if (value === true) return key;
99
+ return `${key}="${escapeHtml(value)}"`;
100
+ }).filter(Boolean).join('') : '';
101
+ return `<${tagName}${attrStr}>`;
102
+ }
103
+
104
+ function htmlClose(tagName) {
105
+ return `</${tagName}>`;
106
+ }
107
+
108
+ function wrapHtml(tagName, content, attrs) {
109
+ if (content == null) return htmlOpen(tagName, attrs);
110
+ return htmlOpen(tagName, attrs) + (content || '') + htmlClose(tagName);
111
+ }
112
+
113
+ function buildCode(fn, args) {
114
+ const params = args.map(arg => {
115
+ if (typeof arg === 'function') return arg.toString();
116
+ return JSON.stringify(arg != null ? arg : null);
117
+ }).join(',');
118
+ return `(${fn.toString()})(${params})`;
119
+ }
120
+
121
+ function persistJS(items, context) {
122
+ return items.map(item => {
123
+ if (item.type === 'script') {
124
+ const _item$data = item.data,
125
+ {
126
+ textContent
127
+ } = _item$data,
128
+ rest = _objectWithoutPropertiesLoose(_item$data, _excluded);
129
+
130
+ return wrapHtml('script', textContent || '', rest);
131
+ }
132
+
133
+ if (item.type === 'iife') {
134
+ const {
135
+ fn,
136
+ getParams
137
+ } = item.data;
138
+ return wrapHtml('script', escapeScript(buildCode(fn, (getParams == null ? void 0 : getParams(context)) || [])));
139
+ }
140
+
141
+ return '';
142
+ });
143
+ }
144
+
145
+ function persistCSS(items) {
146
+ return items.map(item => {
147
+ if (item.type === 'stylesheet') {
148
+ return wrapHtml('link', null, _extends({
149
+ rel: 'stylesheet'
150
+ }, item.data));
151
+ }
152
+ /* else if (item.type === 'style') */
153
+
154
+
155
+ return wrapHtml('style', item.data);
156
+ });
157
+ }
158
+
159
+ Math.random().toString(36).slice(2, 8);
160
+
161
+ function wrapFunction(fn, {
162
+ before,
163
+ after
164
+ }) {
165
+ return function wrapped(...args) {
166
+ const ctx = {
167
+ args,
168
+ thisObj: this
169
+ };
170
+
171
+ try {
172
+ if (before) before(ctx);
173
+ } catch (_unused) {// ignore
174
+ }
175
+
176
+ ctx.result = fn.apply(ctx.thisObj, ctx.args);
177
+
178
+ try {
179
+ if (after) after(ctx);
180
+ } catch (_unused2) {// ignore
181
+ }
182
+
183
+ return ctx.result;
184
+ };
185
+ }
186
+
20
187
  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";
21
- const BASE_JS = [`https://cdn.jsdelivr.net/npm/d3@${"6.7.0"}`, `https://cdn.jsdelivr.net/npm/markmap-view@${"0.13.5"}`].map(src => ({
188
+ 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 => ({
22
189
  type: 'script',
23
190
  data: {
24
191
  src
@@ -32,14 +199,14 @@ function fillTemplate(root, assets, extra) {
32
199
  scripts,
33
200
  styles
34
201
  } = assets;
35
- const cssList = [...(styles ? markmapCommon.persistCSS(styles) : [])];
202
+ const cssList = [...(styles ? persistCSS(styles) : [])];
36
203
  const context = {
37
204
  getMarkmap: () => window.markmap,
38
205
  getOptions: extra.getOptions,
39
206
  jsonOptions: extra.jsonOptions,
40
207
  root
41
208
  };
42
- const jsList = [...markmapCommon.persistJS([...extra.baseJs, ...(scripts || []), {
209
+ const jsList = [...persistJS([...extra.baseJs, ...(scripts || []), {
43
210
  type: 'iife',
44
211
  data: {
45
212
  fn: (getMarkmap, getOptions, root, jsonOptions) => {
@@ -61,6 +228,10 @@ function fillTemplate(root, assets, extra) {
61
228
  }
62
229
 
63
230
  var config$1 = {
231
+ versions: {
232
+ katex: "0.15.3",
233
+ webfontloader: "1.6.28"
234
+ },
64
235
  preloadScripts: [{
65
236
  type: 'script',
66
237
  data: {
@@ -109,7 +280,7 @@ function transform$2(transformHooks) {
109
280
 
110
281
  transformHooks.parser.tap(md => {
111
282
  md.use(remarkableKatex__default);
112
- md.renderer.rules.katex = markmapCommon.wrapFunction(md.renderer.rules.katex, {
283
+ md.renderer.rules.katex = wrapFunction(md.renderer.rules.katex, {
113
284
  after: () => {
114
285
  enableFeature();
115
286
  }
@@ -134,6 +305,9 @@ transform: transform$2
134
305
  });
135
306
 
136
307
  var config = {
308
+ versions: {
309
+ prismjs: "1.28.0"
310
+ },
137
311
  preloadScripts: [{
138
312
  type: 'script',
139
313
  data: {
@@ -197,20 +371,28 @@ const name = 'frontmatter';
197
371
  function transform(transformHooks) {
198
372
  transformHooks.transform.tap((md, context) => {
199
373
  const origParse = md.parse;
200
- md.parse = markmapCommon.wrapFunction(origParse, {
374
+ md.parse = wrapFunction(origParse, {
201
375
  before(ctx) {
202
376
  const [content] = ctx.args;
203
377
  if (!content.startsWith('---\n')) return;
204
378
  const endOffset = content.indexOf('\n---\n');
205
379
  if (endOffset < 0) return;
206
380
  const raw = content.slice(4, endOffset);
381
+ let frontmatter;
207
382
 
208
383
  try {
209
- context.frontmatter = yaml__default.load(raw);
384
+ var _frontmatter;
385
+
386
+ frontmatter = yaml__default.load(raw);
387
+
388
+ if ((_frontmatter = frontmatter) != null && _frontmatter.markmap) {
389
+ frontmatter.markmap = normalizeMarkmapJsonOptions(frontmatter.markmap);
390
+ }
210
391
  } catch (_unused) {
211
392
  return;
212
393
  }
213
394
 
395
+ context.frontmatter = frontmatter;
214
396
  const offset = endOffset + 5;
215
397
  ctx.args[0] = content.slice(offset);
216
398
  },
@@ -224,6 +406,30 @@ function transform(transformHooks) {
224
406
  return {};
225
407
  }
226
408
 
409
+ function normalizeMarkmapJsonOptions(options) {
410
+ if (!options) return;
411
+ ['color', 'extraJs', 'extraCss'].forEach(key => {
412
+ if (options[key] != null) options[key] = normalizeStringArray(options[key]);
413
+ });
414
+ ['duration', 'maxWidth', 'initialExpandLevel'].forEach(key => {
415
+ if (options[key] != null) options[key] = normalizeNumber(options[key]);
416
+ });
417
+ return options;
418
+ }
419
+
420
+ function normalizeStringArray(value) {
421
+ var _result;
422
+
423
+ let result;
424
+ if (typeof value === 'string') result = [value];else if (Array.isArray(value)) result = value.filter(item => item && typeof item === 'string');
425
+ return (_result = result) != null && _result.length ? result : undefined;
426
+ }
427
+
428
+ function normalizeNumber(value) {
429
+ if (isNaN(+value)) return;
430
+ return +value;
431
+ }
432
+
227
433
  var frontmatter = /*#__PURE__*/Object.freeze({
228
434
  __proto__: null,
229
435
  name: name,
@@ -232,14 +438,14 @@ transform: transform
232
438
 
233
439
  function createTransformHooks() {
234
440
  return {
235
- parser: new markmapCommon.Hook(),
236
- transform: new markmapCommon.Hook(),
237
- htmltag: new markmapCommon.Hook(),
238
- retransform: new markmapCommon.Hook()
441
+ parser: new Hook(),
442
+ transform: new Hook(),
443
+ htmltag: new Hook(),
444
+ retransform: new Hook()
239
445
  };
240
446
  }
241
447
 
242
- const plugins = [katex, prism, frontmatter];
448
+ const plugins = [frontmatter, katex, prism];
243
449
 
244
450
  function cleanNode(node) {
245
451
  if (node.type === 'heading') {
@@ -318,7 +524,7 @@ class Transformer {
318
524
  breaks: true,
319
525
  maxNesting: Infinity
320
526
  });
321
- md.renderer.rules.htmltag = markmapCommon.wrapFunction(md.renderer.rules.htmltag, {
527
+ md.renderer.rules.htmltag = wrapFunction(md.renderer.rules.htmltag, {
322
528
  after: ctx => {
323
529
  this.hooks.htmltag.call(ctx);
324
530
  }
@@ -445,7 +651,7 @@ class Transformer {
445
651
 
446
652
  const styles = [];
447
653
  const scripts = [];
448
- (_keys = keys) != null ? _keys : keys = Object.keys(this.assetsMap);
654
+ (_keys = keys) != null ? _keys : keys = this.plugins.map(plugin => plugin.name);
449
655
 
450
656
  for (const assets of keys.map(key => this.assetsMap[key])) {
451
657
  if (assets) {
@@ -465,11 +671,18 @@ class Transformer {
465
671
 
466
672
 
467
673
  getUsedAssets(features) {
468
- return this.getAssets(Object.keys(features).filter(key => features[key]));
674
+ const keys = this.plugins.map(plugin => plugin.name).filter(name => features[name]);
675
+ return this.getAssets(keys);
469
676
  }
470
677
 
471
678
  }
472
679
 
680
+ const transformerVersions = {
681
+ 'markmap-lib': '0.13.6-alpha.4+70ae484',
682
+ d3: "6.7.0"
683
+ };
684
+
473
685
  exports.Transformer = Transformer;
474
686
  exports.builtInPlugins = plugins;
475
687
  exports.fillTemplate = fillTemplate;
688
+ exports.transformerVersions = transformerVersions;