markmap-lib 0.17.3-beta.4 → 0.18.1-alpha.1

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.
@@ -14058,7 +14058,7 @@
14058
14058
  }
14059
14059
  function getCurrentHeading(level) {
14060
14060
  let heading2;
14061
- while ((heading2 = headingStack.at(-1)) && heading2.level >= level) {
14061
+ while ((heading2 = headingStack[headingStack.length - 1]) && heading2.level >= level) {
14062
14062
  headingStack.pop();
14063
14063
  }
14064
14064
  return heading2 || rootNode;
@@ -14145,6 +14145,7 @@
14145
14145
  };
14146
14146
  if (htmlNode.data) {
14147
14147
  node.payload = {
14148
+ tag: htmlNode.tag,
14148
14149
  ...htmlNode.data
14149
14150
  };
14150
14151
  }
@@ -25273,8 +25274,10 @@ ${end2.comment}` : end2.comment;
25273
25274
  ...context.parserOptions,
25274
25275
  ...(_a2 = frontmatter == null ? void 0 : frontmatter.markmap) == null ? void 0 : _a2.htmlParser
25275
25276
  };
25276
- context.content = content.slice(match.index + match[0].length);
25277
- context.contentLineOffset = content.slice(0, match.index).split("\n").length + 1;
25277
+ context.frontmatterInfo = {
25278
+ lines: content.slice(0, match.index).split("\n").length + 1,
25279
+ offset: match.index + match[0].length
25280
+ };
25278
25281
  });
25279
25282
  return {};
25280
25283
  }
@@ -25968,13 +25971,19 @@ ${end2.comment}` : end2.comment;
25968
25971
  const plugin = definePlugin({
25969
25972
  name,
25970
25973
  transform(transformHooks) {
25974
+ let frontmatterLines = 0;
25975
+ transformHooks.beforeParse.tap((_md, context) => {
25976
+ var _a2;
25977
+ frontmatterLines = ((_a2 = context.frontmatterInfo) == null ? void 0 : _a2.lines) || 0;
25978
+ });
25971
25979
  transformHooks.parser.tap((md) => {
25972
25980
  md.renderer.renderAttrs = wrapFunction(
25973
25981
  md.renderer.renderAttrs,
25974
25982
  (renderAttrs, token) => {
25975
25983
  let attrs = renderAttrs(token);
25976
25984
  if (token.block && token.map) {
25977
- attrs += ` data-lines=${token.map.join(",")}`;
25985
+ const lineRange = token.map.map((line) => line + frontmatterLines);
25986
+ attrs += ` data-lines=${lineRange.join(",")}`;
25978
25987
  }
25979
25988
  return attrs;
25980
25989
  }
@@ -26029,16 +26038,24 @@ ${end2.comment}` : end2.comment;
26029
26038
  const context = {
26030
26039
  content,
26031
26040
  features: {},
26032
- contentLineOffset: 0,
26033
26041
  parserOptions: fallbackParserOptions
26034
26042
  };
26035
26043
  this.hooks.beforeParse.call(this.md, context);
26036
- const html2 = this.md.render(context.content, {});
26044
+ let { content: rawContent } = context;
26045
+ if (context.frontmatterInfo)
26046
+ rawContent = rawContent.slice(context.frontmatterInfo.offset);
26047
+ const html2 = this.md.render(rawContent, {});
26037
26048
  this.hooks.afterParse.call(this.md, context);
26038
26049
  const root2 = cleanNode(buildTree(html2, context.parserOptions));
26039
26050
  root2.content || (root2.content = `${((_a2 = context.frontmatter) == null ? void 0 : _a2.title) || ""}`);
26040
26051
  return { ...context, root: root2 };
26041
26052
  }
26053
+ resolveJS(item) {
26054
+ return patchJSItem(this.urlBuilder, item);
26055
+ }
26056
+ resolveCSS(item) {
26057
+ return patchCSSItem(this.urlBuilder, item);
26058
+ }
26042
26059
  /**
26043
26060
  * Get all assets from enabled plugins or filter them by plugin names as keys.
26044
26061
  */
@@ -26053,10 +26070,17 @@ ${end2.comment}` : end2.comment;
26053
26070
  }
26054
26071
  }
26055
26072
  return {
26056
- styles: styles2.map((item) => patchCSSItem(this.urlBuilder, item)),
26057
- scripts: scripts.map((item) => patchJSItem(this.urlBuilder, item))
26073
+ styles: styles2.map((item) => this.resolveCSS(item)),
26074
+ scripts: scripts.map((item) => this.resolveJS(item))
26058
26075
  };
26059
26076
  }
26077
+ getPreloadScripts() {
26078
+ const scripts = this.plugins.flatMap((plugin2) => {
26079
+ var _a2;
26080
+ return ((_a2 = plugin2.config) == null ? void 0 : _a2.preloadScripts) || [];
26081
+ }).map((item) => this.resolveJS(item));
26082
+ return { scripts };
26083
+ }
26060
26084
  /**
26061
26085
  * Get used assets by features object returned by `transform`.
26062
26086
  */
@@ -26066,10 +26090,12 @@ ${end2.comment}` : end2.comment;
26066
26090
  }
26067
26091
  }
26068
26092
  const transformerVersions = {
26069
- "markmap-lib": "0.17.3-beta.4"
26093
+ "markmap-lib": "0.18.1-alpha.1"
26070
26094
  };
26071
26095
  exports.Transformer = Transformer;
26072
26096
  exports.builtInPlugins = builtInPlugins;
26097
+ exports.patchCSSItem = patchCSSItem;
26098
+ exports.patchJSItem = patchJSItem;
26073
26099
  exports.transformerVersions = transformerVersions;
26074
26100
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
26075
26101
  })(this.markmap = this.markmap || {}, window.katex);
@@ -85,8 +85,10 @@ const pluginFrontmatter = definePlugin({
85
85
  ...context.parserOptions,
86
86
  ...(_a = frontmatter == null ? void 0 : frontmatter.markmap) == null ? void 0 : _a.htmlParser
87
87
  };
88
- context.content = content.slice(match.index + match[0].length);
89
- context.contentLineOffset = content.slice(0, match.index).split("\n").length + 1;
88
+ context.frontmatterInfo = {
89
+ lines: content.slice(0, match.index).split("\n").length + 1,
90
+ offset: match.index + match[0].length
91
+ };
90
92
  });
91
93
  return {};
92
94
  }
@@ -358,13 +360,19 @@ const name = "sourceLines";
358
360
  const plugin = definePlugin({
359
361
  name,
360
362
  transform(transformHooks) {
363
+ let frontmatterLines = 0;
364
+ transformHooks.beforeParse.tap((_md, context) => {
365
+ var _a;
366
+ frontmatterLines = ((_a = context.frontmatterInfo) == null ? void 0 : _a.lines) || 0;
367
+ });
361
368
  transformHooks.parser.tap((md) => {
362
369
  md.renderer.renderAttrs = wrapFunction(
363
370
  md.renderer.renderAttrs,
364
371
  (renderAttrs, token) => {
365
372
  let attrs = renderAttrs(token);
366
373
  if (token.block && token.map) {
367
- attrs += ` data-lines=${token.map.join(",")}`;
374
+ const lineRange = token.map.map((line) => line + frontmatterLines);
375
+ attrs += ` data-lines=${lineRange.join(",")}`;
368
376
  }
369
377
  return attrs;
370
378
  }
@@ -419,16 +427,24 @@ class Transformer {
419
427
  const context = {
420
428
  content,
421
429
  features: {},
422
- contentLineOffset: 0,
423
430
  parserOptions: fallbackParserOptions
424
431
  };
425
432
  this.hooks.beforeParse.call(this.md, context);
426
- const html = this.md.render(context.content, {});
433
+ let { content: rawContent } = context;
434
+ if (context.frontmatterInfo)
435
+ rawContent = rawContent.slice(context.frontmatterInfo.offset);
436
+ const html = this.md.render(rawContent, {});
427
437
  this.hooks.afterParse.call(this.md, context);
428
438
  const root = cleanNode(buildTree(html, context.parserOptions));
429
439
  root.content || (root.content = `${((_a = context.frontmatter) == null ? void 0 : _a.title) || ""}`);
430
440
  return { ...context, root };
431
441
  }
442
+ resolveJS(item) {
443
+ return patchJSItem(this.urlBuilder, item);
444
+ }
445
+ resolveCSS(item) {
446
+ return patchCSSItem(this.urlBuilder, item);
447
+ }
432
448
  /**
433
449
  * Get all assets from enabled plugins or filter them by plugin names as keys.
434
450
  */
@@ -443,10 +459,17 @@ class Transformer {
443
459
  }
444
460
  }
445
461
  return {
446
- styles: styles2.map((item) => patchCSSItem(this.urlBuilder, item)),
447
- scripts: scripts.map((item) => patchJSItem(this.urlBuilder, item))
462
+ styles: styles2.map((item) => this.resolveCSS(item)),
463
+ scripts: scripts.map((item) => this.resolveJS(item))
448
464
  };
449
465
  }
466
+ getPreloadScripts() {
467
+ const scripts = this.plugins.flatMap((plugin2) => {
468
+ var _a;
469
+ return ((_a = plugin2.config) == null ? void 0 : _a.preloadScripts) || [];
470
+ }).map((item) => this.resolveJS(item));
471
+ return { scripts };
472
+ }
450
473
  /**
451
474
  * Get used assets by features object returned by `transform`.
452
475
  */
@@ -456,10 +479,12 @@ class Transformer {
456
479
  }
457
480
  }
458
481
  const transformerVersions = {
459
- "markmap-lib": "0.17.3-beta.4"
482
+ "markmap-lib": "0.18.1-alpha.1"
460
483
  };
461
484
  export {
462
485
  Transformer,
463
486
  builtInPlugins,
487
+ patchCSSItem,
488
+ patchJSItem,
464
489
  transformerVersions
465
490
  };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- export * from './types';
2
1
  export * from './transform';
2
+ export * from './types';
3
+ export * from './util';
3
4
  export declare const transformerVersions: {
4
5
  'markmap-lib': string | undefined;
5
6
  };
package/dist/index.js CHANGED
@@ -78,16 +78,24 @@ class Transformer {
78
78
  const context = {
79
79
  content,
80
80
  features: {},
81
- contentLineOffset: 0,
82
81
  parserOptions: fallbackParserOptions
83
82
  };
84
83
  this.hooks.beforeParse.call(this.md, context);
85
- const html = this.md.render(context.content, {});
84
+ let { content: rawContent } = context;
85
+ if (context.frontmatterInfo)
86
+ rawContent = rawContent.slice(context.frontmatterInfo.offset);
87
+ const html = this.md.render(rawContent, {});
86
88
  this.hooks.afterParse.call(this.md, context);
87
89
  const root = cleanNode(markmapHtmlParser.buildTree(html, context.parserOptions));
88
90
  root.content || (root.content = `${((_a = context.frontmatter) == null ? void 0 : _a.title) || ""}`);
89
91
  return { ...context, root };
90
92
  }
93
+ resolveJS(item) {
94
+ return patchJSItem(this.urlBuilder, item);
95
+ }
96
+ resolveCSS(item) {
97
+ return patchCSSItem(this.urlBuilder, item);
98
+ }
91
99
  /**
92
100
  * Get all assets from enabled plugins or filter them by plugin names as keys.
93
101
  */
@@ -102,10 +110,17 @@ class Transformer {
102
110
  }
103
111
  }
104
112
  return {
105
- styles: styles.map((item) => patchCSSItem(this.urlBuilder, item)),
106
- scripts: scripts.map((item) => patchJSItem(this.urlBuilder, item))
113
+ styles: styles.map((item) => this.resolveCSS(item)),
114
+ scripts: scripts.map((item) => this.resolveJS(item))
107
115
  };
108
116
  }
117
+ getPreloadScripts() {
118
+ const scripts = this.plugins.flatMap((plugin) => {
119
+ var _a;
120
+ return ((_a = plugin.config) == null ? void 0 : _a.preloadScripts) || [];
121
+ }).map((item) => this.resolveJS(item));
122
+ return { scripts };
123
+ }
109
124
  /**
110
125
  * Get used assets by features object returned by `transform`.
111
126
  */
@@ -115,8 +130,10 @@ class Transformer {
115
130
  }
116
131
  }
117
132
  const transformerVersions = {
118
- "markmap-lib": "0.17.3-beta.4"
133
+ "markmap-lib": "0.18.1-alpha.1"
119
134
  };
120
135
  exports.Transformer = Transformer;
121
136
  exports.builtInPlugins = builtInPlugins;
137
+ exports.patchCSSItem = patchCSSItem;
138
+ exports.patchJSItem = patchJSItem;
122
139
  exports.transformerVersions = transformerVersions;
package/dist/index.mjs CHANGED
@@ -76,16 +76,24 @@ class Transformer {
76
76
  const context = {
77
77
  content,
78
78
  features: {},
79
- contentLineOffset: 0,
80
79
  parserOptions: fallbackParserOptions
81
80
  };
82
81
  this.hooks.beforeParse.call(this.md, context);
83
- const html = this.md.render(context.content, {});
82
+ let { content: rawContent } = context;
83
+ if (context.frontmatterInfo)
84
+ rawContent = rawContent.slice(context.frontmatterInfo.offset);
85
+ const html = this.md.render(rawContent, {});
84
86
  this.hooks.afterParse.call(this.md, context);
85
87
  const root = cleanNode(buildTree(html, context.parserOptions));
86
88
  root.content || (root.content = `${((_a = context.frontmatter) == null ? void 0 : _a.title) || ""}`);
87
89
  return { ...context, root };
88
90
  }
91
+ resolveJS(item) {
92
+ return patchJSItem(this.urlBuilder, item);
93
+ }
94
+ resolveCSS(item) {
95
+ return patchCSSItem(this.urlBuilder, item);
96
+ }
89
97
  /**
90
98
  * Get all assets from enabled plugins or filter them by plugin names as keys.
91
99
  */
@@ -100,10 +108,17 @@ class Transformer {
100
108
  }
101
109
  }
102
110
  return {
103
- styles: styles.map((item) => patchCSSItem(this.urlBuilder, item)),
104
- scripts: scripts.map((item) => patchJSItem(this.urlBuilder, item))
111
+ styles: styles.map((item) => this.resolveCSS(item)),
112
+ scripts: scripts.map((item) => this.resolveJS(item))
105
113
  };
106
114
  }
115
+ getPreloadScripts() {
116
+ const scripts = this.plugins.flatMap((plugin) => {
117
+ var _a;
118
+ return ((_a = plugin.config) == null ? void 0 : _a.preloadScripts) || [];
119
+ }).map((item) => this.resolveJS(item));
120
+ return { scripts };
121
+ }
107
122
  /**
108
123
  * Get used assets by features object returned by `transform`.
109
124
  */
@@ -113,10 +128,12 @@ class Transformer {
113
128
  }
114
129
  }
115
130
  const transformerVersions = {
116
- "markmap-lib": "0.17.3-beta.4"
131
+ "markmap-lib": "0.18.1-alpha.1"
117
132
  };
118
133
  export {
119
134
  Transformer,
120
135
  builtInPlugins,
136
+ patchCSSItem,
137
+ patchJSItem,
121
138
  transformerVersions
122
139
  };
@@ -86,16 +86,24 @@ class Transformer {
86
86
  const context = {
87
87
  content,
88
88
  features: {},
89
- contentLineOffset: 0,
90
89
  parserOptions: fallbackParserOptions
91
90
  };
92
91
  this.hooks.beforeParse.call(this.md, context);
93
- const html = this.md.render(context.content, {});
92
+ let { content: rawContent } = context;
93
+ if (context.frontmatterInfo)
94
+ rawContent = rawContent.slice(context.frontmatterInfo.offset);
95
+ const html = this.md.render(rawContent, {});
94
96
  this.hooks.afterParse.call(this.md, context);
95
97
  const root = cleanNode(markmapHtmlParser.buildTree(html, context.parserOptions));
96
98
  root.content || (root.content = `${((_a = context.frontmatter) == null ? void 0 : _a.title) || ""}`);
97
99
  return { ...context, root };
98
100
  }
101
+ resolveJS(item) {
102
+ return patchJSItem(this.urlBuilder, item);
103
+ }
104
+ resolveCSS(item) {
105
+ return patchCSSItem(this.urlBuilder, item);
106
+ }
99
107
  /**
100
108
  * Get all assets from enabled plugins or filter them by plugin names as keys.
101
109
  */
@@ -110,10 +118,17 @@ class Transformer {
110
118
  }
111
119
  }
112
120
  return {
113
- styles: styles.map((item) => patchCSSItem(this.urlBuilder, item)),
114
- scripts: scripts.map((item) => patchJSItem(this.urlBuilder, item))
121
+ styles: styles.map((item) => this.resolveCSS(item)),
122
+ scripts: scripts.map((item) => this.resolveJS(item))
115
123
  };
116
124
  }
125
+ getPreloadScripts() {
126
+ const scripts = this.plugins.flatMap((plugin) => {
127
+ var _a;
128
+ return ((_a = plugin.config) == null ? void 0 : _a.preloadScripts) || [];
129
+ }).map((item) => this.resolveJS(item));
130
+ return { scripts };
131
+ }
117
132
  /**
118
133
  * Get used assets by features object returned by `transform`.
119
134
  */
@@ -123,8 +138,10 @@ class Transformer {
123
138
  }
124
139
  }
125
140
  const transformerVersions = {
126
- "markmap-lib": "0.17.3-beta.4"
141
+ "markmap-lib": "0.18.1-alpha.1"
127
142
  };
128
143
  exports.Transformer = Transformer;
129
144
  exports.builtInPlugins = builtInPlugins;
145
+ exports.patchCSSItem = patchCSSItem;
146
+ exports.patchJSItem = patchJSItem;
130
147
  exports.transformerVersions = transformerVersions;
@@ -84,16 +84,24 @@ class Transformer {
84
84
  const context = {
85
85
  content,
86
86
  features: {},
87
- contentLineOffset: 0,
88
87
  parserOptions: fallbackParserOptions
89
88
  };
90
89
  this.hooks.beforeParse.call(this.md, context);
91
- const html = this.md.render(context.content, {});
90
+ let { content: rawContent } = context;
91
+ if (context.frontmatterInfo)
92
+ rawContent = rawContent.slice(context.frontmatterInfo.offset);
93
+ const html = this.md.render(rawContent, {});
92
94
  this.hooks.afterParse.call(this.md, context);
93
95
  const root = cleanNode(buildTree(html, context.parserOptions));
94
96
  root.content || (root.content = `${((_a = context.frontmatter) == null ? void 0 : _a.title) || ""}`);
95
97
  return { ...context, root };
96
98
  }
99
+ resolveJS(item) {
100
+ return patchJSItem(this.urlBuilder, item);
101
+ }
102
+ resolveCSS(item) {
103
+ return patchCSSItem(this.urlBuilder, item);
104
+ }
97
105
  /**
98
106
  * Get all assets from enabled plugins or filter them by plugin names as keys.
99
107
  */
@@ -108,10 +116,17 @@ class Transformer {
108
116
  }
109
117
  }
110
118
  return {
111
- styles: styles.map((item) => patchCSSItem(this.urlBuilder, item)),
112
- scripts: scripts.map((item) => patchJSItem(this.urlBuilder, item))
119
+ styles: styles.map((item) => this.resolveCSS(item)),
120
+ scripts: scripts.map((item) => this.resolveJS(item))
113
121
  };
114
122
  }
123
+ getPreloadScripts() {
124
+ const scripts = this.plugins.flatMap((plugin) => {
125
+ var _a;
126
+ return ((_a = plugin.config) == null ? void 0 : _a.preloadScripts) || [];
127
+ }).map((item) => this.resolveJS(item));
128
+ return { scripts };
129
+ }
115
130
  /**
116
131
  * Get used assets by features object returned by `transform`.
117
132
  */
@@ -121,10 +136,12 @@ class Transformer {
121
136
  }
122
137
  }
123
138
  const transformerVersions = {
124
- "markmap-lib": "0.17.3-beta.4"
139
+ "markmap-lib": "0.18.1-alpha.1"
125
140
  };
126
141
  export {
127
142
  Transformer,
128
143
  builtInPlugins,
144
+ patchCSSItem,
145
+ patchJSItem,
129
146
  transformerVersions
130
147
  };
package/dist/plugins.js CHANGED
@@ -74,8 +74,10 @@ const pluginFrontmatter = definePlugin({
74
74
  ...context.parserOptions,
75
75
  ...(_a = frontmatter == null ? void 0 : frontmatter.markmap) == null ? void 0 : _a.htmlParser
76
76
  };
77
- context.content = content.slice(match.index + match[0].length);
78
- context.contentLineOffset = content.slice(0, match.index).split("\n").length + 1;
77
+ context.frontmatterInfo = {
78
+ lines: content.slice(0, match.index).split("\n").length + 1,
79
+ offset: match.index + match[0].length
80
+ };
79
81
  });
80
82
  return {};
81
83
  }
@@ -255,13 +257,19 @@ const name = "sourceLines";
255
257
  const plugin = definePlugin({
256
258
  name,
257
259
  transform(transformHooks) {
260
+ let frontmatterLines = 0;
261
+ transformHooks.beforeParse.tap((_md, context) => {
262
+ var _a;
263
+ frontmatterLines = ((_a = context.frontmatterInfo) == null ? void 0 : _a.lines) || 0;
264
+ });
258
265
  transformHooks.parser.tap((md) => {
259
266
  md.renderer.renderAttrs = markmapCommon.wrapFunction(
260
267
  md.renderer.renderAttrs,
261
268
  (renderAttrs, token) => {
262
269
  let attrs = renderAttrs(token);
263
270
  if (token.block && token.map) {
264
- attrs += ` data-lines=${token.map.join(",")}`;
271
+ const lineRange = token.map.map((line) => line + frontmatterLines);
272
+ attrs += ` data-lines=${lineRange.join(",")}`;
265
273
  }
266
274
  return attrs;
267
275
  }
package/dist/plugins.mjs CHANGED
@@ -72,8 +72,10 @@ const pluginFrontmatter = definePlugin({
72
72
  ...context.parserOptions,
73
73
  ...(_a = frontmatter == null ? void 0 : frontmatter.markmap) == null ? void 0 : _a.htmlParser
74
74
  };
75
- context.content = content.slice(match.index + match[0].length);
76
- context.contentLineOffset = content.slice(0, match.index).split("\n").length + 1;
75
+ context.frontmatterInfo = {
76
+ lines: content.slice(0, match.index).split("\n").length + 1,
77
+ offset: match.index + match[0].length
78
+ };
77
79
  });
78
80
  return {};
79
81
  }
@@ -253,13 +255,19 @@ const name = "sourceLines";
253
255
  const plugin = definePlugin({
254
256
  name,
255
257
  transform(transformHooks) {
258
+ let frontmatterLines = 0;
259
+ transformHooks.beforeParse.tap((_md, context) => {
260
+ var _a;
261
+ frontmatterLines = ((_a = context.frontmatterInfo) == null ? void 0 : _a.lines) || 0;
262
+ });
256
263
  transformHooks.parser.tap((md) => {
257
264
  md.renderer.renderAttrs = wrapFunction(
258
265
  md.renderer.renderAttrs,
259
266
  (renderAttrs, token) => {
260
267
  let attrs = renderAttrs(token);
261
268
  if (token.block && token.map) {
262
- attrs += ` data-lines=${token.map.join(",")}`;
269
+ const lineRange = token.map.map((line) => line + frontmatterLines);
270
+ attrs += ` data-lines=${lineRange.join(",")}`;
263
271
  }
264
272
  return attrs;
265
273
  }
@@ -1,5 +1,5 @@
1
1
  import type MarkdownIt from 'markdown-it';
2
- import { UrlBuilder } from 'markmap-common';
2
+ import { CSSItem, JSItem, UrlBuilder } from 'markmap-common';
3
3
  import { IHtmlParserOptions } from 'markmap-html-parser';
4
4
  import { IAssets, IFeatures, ITransformHooks, ITransformPlugin, ITransformResult, ITransformer } from './types';
5
5
  export declare const builtInPlugins: ITransformPlugin[];
@@ -11,10 +11,13 @@ export declare class Transformer implements ITransformer {
11
11
  plugins: ITransformPlugin[];
12
12
  constructor(plugins?: Array<ITransformPlugin | (() => ITransformPlugin)>);
13
13
  transform(content: string, fallbackParserOptions?: Partial<IHtmlParserOptions>): ITransformResult;
14
+ resolveJS(item: JSItem): JSItem;
15
+ resolveCSS(item: CSSItem): CSSItem;
14
16
  /**
15
17
  * Get all assets from enabled plugins or filter them by plugin names as keys.
16
18
  */
17
19
  getAssets(keys?: string[]): IAssets;
20
+ getPreloadScripts(): IAssets;
18
21
  /**
19
22
  * Get used assets by features object returned by `transform`.
20
23
  */
package/dist/types.d.ts CHANGED
@@ -52,8 +52,10 @@ export interface ITransformContext {
52
52
  title?: string;
53
53
  markmap?: IMarkmapJSONOptions;
54
54
  };
55
- /** The index of line where content without frontmatter starts */
56
- contentLineOffset: number;
55
+ frontmatterInfo?: {
56
+ lines: number;
57
+ offset: number;
58
+ };
57
59
  parserOptions?: Partial<IHtmlParserOptions>;
58
60
  }
59
61
  export interface ITransformResult extends ITransformContext {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "markmap-lib",
3
- "version": "0.17.3-beta.4+120a195",
3
+ "version": "0.18.1-alpha.1+f00ade4",
4
4
  "description": "Visualize your Markdown as mindmaps with Markmap",
5
5
  "author": "Gerald <gera2ld@live.com>",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "@highlightjs/cdn-assets": "^11.8.0",
62
62
  "@types/katex": "^0.16.7",
63
63
  "@types/markdown-it": "^14.0.0",
64
- "markmap-common": "0.17.3-beta.4+120a195",
64
+ "markmap-common": "0.18.0",
65
65
  "webfontloader": "^1.6.28"
66
66
  },
67
67
  "dependencies": {
@@ -74,8 +74,8 @@
74
74
  "markdown-it-mark": "^4.0.0",
75
75
  "markdown-it-sub": "^2.0.0",
76
76
  "markdown-it-sup": "^2.0.0",
77
- "markmap-html-parser": "0.17.3-beta.4+120a195",
78
- "markmap-view": "0.17.3-beta.4+120a195",
77
+ "markmap-html-parser": "0.18.0",
78
+ "markmap-view": "0.18.0",
79
79
  "prismjs": "^1.29.0",
80
80
  "yaml": "^2.5.1"
81
81
  },
@@ -96,5 +96,5 @@
96
96
  "^(.*\\.svg)\\?raw$": "$1"
97
97
  }
98
98
  },
99
- "gitHead": "120a1954940590e194130156a4c5fb60d82c0b3d"
99
+ "gitHead": "f00ade49c4b34f9c34579e67cd185ad29afd6950"
100
100
  }