@cnblogs/markdown-it-presets 1.5.8

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.
Files changed (76) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +18 -0
  3. package/index.js.map +1 -0
  4. package/lib-esm/index.js +2 -0
  5. package/lib-esm/index.js.map +1 -0
  6. package/lib-esm/markdown-it-factory.js +98 -0
  7. package/lib-esm/markdown-it-factory.js.map +1 -0
  8. package/lib-esm/option.js +27 -0
  9. package/lib-esm/option.js.map +1 -0
  10. package/lib-esm/plugins/highlight-code-lines.plugin.js +45 -0
  11. package/lib-esm/plugins/highlight-code-lines.plugin.js.map +1 -0
  12. package/lib-esm/plugins/html-filter.plugin.js +43 -0
  13. package/lib-esm/plugins/html-filter.plugin.js.map +1 -0
  14. package/lib-esm/plugins/meta.js +36 -0
  15. package/lib-esm/plugins/meta.js.map +1 -0
  16. package/lib-esm/plugins/multiline-blockquote/multiline-blockquote.plugin.js +5 -0
  17. package/lib-esm/plugins/multiline-blockquote/multiline-blockquote.plugin.js.map +1 -0
  18. package/lib-esm/plugins/multiline-blockquote/multiline-blockquote.rule.js +44 -0
  19. package/lib-esm/plugins/multiline-blockquote/multiline-blockquote.rule.js.map +1 -0
  20. package/lib-esm/plugins/simple-math.plugin.js +147 -0
  21. package/lib-esm/plugins/simple-math.plugin.js.map +1 -0
  22. package/lib-esm/plugins/simple-mermaid.plugin.js +17 -0
  23. package/lib-esm/plugins/simple-mermaid.plugin.js.map +1 -0
  24. package/lib-esm/plugins/toc/index.js +184 -0
  25. package/lib-esm/plugins/toc/index.js.map +1 -0
  26. package/lib-esm/plugins/toc/slugify.js +5 -0
  27. package/lib-esm/plugins/toc/slugify.js.map +1 -0
  28. package/lib-esm/plugins/toc/toc-item.js +2 -0
  29. package/lib-esm/plugins/toc/toc-item.js.map +1 -0
  30. package/lib-esm/plugins/toc/toc-option.js +17 -0
  31. package/lib-esm/plugins/toc/toc-option.js.map +1 -0
  32. package/lib-esm/tsconfig.build.tsbuildinfo +1 -0
  33. package/markdown-it-factory.d.ts +5 -0
  34. package/markdown-it-factory.js +105 -0
  35. package/markdown-it-factory.js.map +1 -0
  36. package/option.d.ts +22 -0
  37. package/option.js +36 -0
  38. package/option.js.map +1 -0
  39. package/package.json +77 -0
  40. package/plugins/highlight-code-lines.plugin.d.ts +3 -0
  41. package/plugins/highlight-code-lines.plugin.js +48 -0
  42. package/plugins/highlight-code-lines.plugin.js.map +1 -0
  43. package/plugins/html-filter.plugin.d.ts +2 -0
  44. package/plugins/html-filter.plugin.js +47 -0
  45. package/plugins/html-filter.plugin.js.map +1 -0
  46. package/plugins/meta.d.ts +2 -0
  47. package/plugins/meta.js +40 -0
  48. package/plugins/meta.js.map +1 -0
  49. package/plugins/multiline-blockquote/multiline-blockquote.plugin.d.ts +2 -0
  50. package/plugins/multiline-blockquote/multiline-blockquote.plugin.js +9 -0
  51. package/plugins/multiline-blockquote/multiline-blockquote.plugin.js.map +1 -0
  52. package/plugins/multiline-blockquote/multiline-blockquote.rule.d.ts +2 -0
  53. package/plugins/multiline-blockquote/multiline-blockquote.rule.js +48 -0
  54. package/plugins/multiline-blockquote/multiline-blockquote.rule.js.map +1 -0
  55. package/plugins/simple-math.plugin.d.ts +2 -0
  56. package/plugins/simple-math.plugin.js +151 -0
  57. package/plugins/simple-math.plugin.js.map +1 -0
  58. package/plugins/simple-mermaid.plugin.d.ts +2 -0
  59. package/plugins/simple-mermaid.plugin.js +21 -0
  60. package/plugins/simple-mermaid.plugin.js.map +1 -0
  61. package/plugins/toc/index.d.ts +3 -0
  62. package/plugins/toc/index.js +187 -0
  63. package/plugins/toc/index.js.map +1 -0
  64. package/plugins/toc/slugify.d.ts +2 -0
  65. package/plugins/toc/slugify.js +8 -0
  66. package/plugins/toc/slugify.js.map +1 -0
  67. package/plugins/toc/toc-item.d.ts +9 -0
  68. package/plugins/toc/toc-item.js +3 -0
  69. package/plugins/toc/toc-item.js.map +1 -0
  70. package/plugins/toc/toc-option.d.ts +26 -0
  71. package/plugins/toc/toc-option.js +20 -0
  72. package/plugins/toc/toc-option.js.map +1 -0
  73. package/styles/task-lists.less +19 -0
  74. package/styles/task-lists.min.css +1 -0
  75. package/tsconfig.build.tsbuildinfo +1 -0
  76. package/umd/markdown-it-presets.js +1 -0
@@ -0,0 +1,184 @@
1
+ import { defaultTocOption } from './toc-option';
2
+ const defaults = defaultTocOption;
3
+ const findHeadlineElements = (levels, tokens, options, md, env) => {
4
+ const headings = [];
5
+ let currentHeading = null;
6
+ tokens.forEach(token => {
7
+ if (token.type === 'heading_open') {
8
+ const id = findExistingIdAttr(token);
9
+ const level = parseInt(token.tag.toLowerCase().replace('h', ''), 10);
10
+ if (levels.indexOf(level) >= 0) {
11
+ currentHeading = {
12
+ level: level,
13
+ textContent: null,
14
+ anchor: id || null,
15
+ markdownContent: null,
16
+ };
17
+ }
18
+ }
19
+ else if (currentHeading && token.type === 'inline') {
20
+ const textContent = token.children
21
+ .filter(childToken => childToken.type === 'text' || childToken.type === 'code_inline')
22
+ .reduce((acc, t) => acc + t.content, '');
23
+ currentHeading.textContent = textContent;
24
+ currentHeading.markdownContent = token.content;
25
+ if (!currentHeading.anchor) {
26
+ currentHeading.anchor = options.slugify(textContent, token.content);
27
+ }
28
+ }
29
+ else if (token.type === 'heading_close') {
30
+ if (currentHeading) {
31
+ headings.push(currentHeading);
32
+ }
33
+ currentHeading = null;
34
+ }
35
+ });
36
+ return headings;
37
+ };
38
+ const findExistingIdAttr = (token) => {
39
+ if (token && token.attrs && token.attrs.length > 0) {
40
+ const idAttr = token.attrs.find(attr => {
41
+ if (Array.isArray(attr) && attr.length >= 2) {
42
+ return attr[0] === 'id';
43
+ }
44
+ return false;
45
+ });
46
+ if (idAttr && Array.isArray(idAttr) && idAttr.length >= 2) {
47
+ const [key, val] = idAttr;
48
+ return val;
49
+ }
50
+ }
51
+ return null;
52
+ };
53
+ function getMinLevel(headlineItems) {
54
+ return Math.min(...headlineItems.map(item => item.level));
55
+ }
56
+ const addListItem = (level, text, anchor, rootNode) => {
57
+ const listItem = {
58
+ level,
59
+ text,
60
+ anchor,
61
+ children: [],
62
+ parent: rootNode,
63
+ };
64
+ rootNode.children.push(listItem);
65
+ return listItem;
66
+ };
67
+ const flatHeadlineItemsToNestedTree = (headlineItems) => {
68
+ const toc = {
69
+ level: getMinLevel(headlineItems) - 1,
70
+ anchor: null,
71
+ text: null,
72
+ children: [],
73
+ parent: null,
74
+ };
75
+ let currentRootNode = toc;
76
+ let prevListItem = currentRootNode;
77
+ headlineItems.forEach(headlineItem => {
78
+ if (headlineItem.level > prevListItem.level) {
79
+ Array.from({ length: headlineItem.level - prevListItem.level }).forEach(_ => {
80
+ currentRootNode = prevListItem;
81
+ prevListItem = addListItem(headlineItem.level, null, null, currentRootNode);
82
+ });
83
+ prevListItem.text = headlineItem.markdownContent;
84
+ prevListItem.anchor = headlineItem.anchor;
85
+ }
86
+ else if (headlineItem.level === prevListItem.level) {
87
+ prevListItem = addListItem(headlineItem.level, headlineItem.markdownContent, headlineItem.anchor, currentRootNode);
88
+ }
89
+ else if (headlineItem.level < prevListItem.level) {
90
+ for (let i = 0; i < prevListItem.level - headlineItem.level; i++) {
91
+ currentRootNode = currentRootNode.parent;
92
+ }
93
+ prevListItem = addListItem(headlineItem.level, headlineItem.markdownContent, headlineItem.anchor, currentRootNode);
94
+ }
95
+ });
96
+ return toc;
97
+ };
98
+ const tocItemToHtml = (tocItem, options, md) => {
99
+ return ('<' +
100
+ options.listType +
101
+ '>' +
102
+ tocItem.children
103
+ .map(childItem => {
104
+ let li = '<li>';
105
+ let anchor = childItem.anchor;
106
+ if (options && options.transformLink) {
107
+ anchor = options.transformLink(anchor);
108
+ }
109
+ let text = childItem.text ? options.format(childItem.text, md, anchor) : null;
110
+ li += anchor ? `<a href="#${anchor}">${text}</a>` : text || '';
111
+ return li + (childItem.children.length > 0 ? tocItemToHtml(childItem, options, md) : '') + '</li>';
112
+ })
113
+ .join('') +
114
+ '</' +
115
+ options.listType +
116
+ '>');
117
+ };
118
+ const plugin = (md, o) => {
119
+ const options = Object.assign({}, defaults, o);
120
+ const tocRegexp = options.markerPattern;
121
+ let gState;
122
+ const toc = (state, silent) => {
123
+ let token;
124
+ let match;
125
+ if (state.src.charCodeAt(state.pos) !== 0x5b) {
126
+ return false;
127
+ }
128
+ if (silent) {
129
+ return false;
130
+ }
131
+ match = tocRegexp.exec(state.src.substr(state.pos));
132
+ match = !match
133
+ ? []
134
+ : match.filter(function (m) {
135
+ return m;
136
+ });
137
+ if (match.length < 1) {
138
+ return false;
139
+ }
140
+ token = state.push('toc_open', 'toc', 1);
141
+ token.markup = '[[toc]]';
142
+ token = state.push('toc_body', '', 0);
143
+ token = state.push('toc_close', 'toc', -1);
144
+ const newline = state.src.indexOf('\n', state.pos);
145
+ if (newline !== -1) {
146
+ state.pos = newline;
147
+ }
148
+ else {
149
+ state.pos = state.pos + state.posMax + 1;
150
+ }
151
+ return true;
152
+ };
153
+ md.renderer.rules.toc_open = (tokens, index) => {
154
+ let tocOpenHtml = '<div class="' + options.containerClass + '">';
155
+ if (options.containerHeaderHtml) {
156
+ tocOpenHtml += options.containerHeaderHtml;
157
+ }
158
+ return tocOpenHtml;
159
+ };
160
+ md.renderer.rules.toc_close = (tokens, index) => {
161
+ let tocFooterHtml = '';
162
+ if (options.containerFooterHtml) {
163
+ tocFooterHtml = options.containerFooterHtml;
164
+ }
165
+ return tocFooterHtml + '</div>';
166
+ };
167
+ md.renderer.rules.toc_body = (tokens, index, opt, env) => {
168
+ if (options.forceFullToc) {
169
+ throw 'forceFullToc was removed in version 0.5.0. For more information, see https://github.com/Oktavilla/markdown-it-table-of-contents/pull/41';
170
+ }
171
+ else {
172
+ const headlineItems = findHeadlineElements(options.includeLevel, gState.tokens, options, md, env);
173
+ const toc = flatHeadlineItemsToNestedTree(headlineItems);
174
+ return tocItemToHtml(toc, options, md);
175
+ }
176
+ };
177
+ md.core.ruler.push('grab_state', state => {
178
+ gState = state;
179
+ return true;
180
+ });
181
+ md.inline.ruler.after('emphasis', 'toc', toc);
182
+ };
183
+ export { plugin as TocPlugin };
184
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/toc/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,gBAAgB,EAAa,MAAM,cAAc,CAAC;AAI3D,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAkClC,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,MAAe,EAAE,OAAO,EAAE,EAAc,EAAE,GAAQ,EAAE,EAAE;IACxF,MAAM,QAAQ,GAAG,EAAE,CAAC;IACpB,IAAI,cAAc,GAAiB,IAAI,CAAC;IAExC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACnB,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE;YAC/B,MAAM,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACrE,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;gBAC5B,cAAc,GAAG;oBACb,KAAK,EAAE,KAAK;oBACZ,WAAW,EAAE,IAAI;oBACjB,MAAM,EAAE,EAAE,IAAI,IAAI;oBAClB,eAAe,EAAE,IAAI;iBACxB,CAAC;aACL;SACJ;aAAM,IAAI,cAAc,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;YAClD,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ;iBAC7B,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,MAAM,IAAI,UAAU,CAAC,IAAI,KAAK,aAAa,CAAC;iBACrF,MAAM,CAAC,C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AED,OAAO,aAAa,GAAG,QAAQ,CAAC;IACpC,CAAC,CAAC;IAEF,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACrD,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,MAAM,yIAAyI,CAAC;SACnJ;aAAM;YACH,MAAM,aAAa,GAAG,oBAAoB,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;YAClG,MAAM,GAAG,GAAG,6BAA6B,CAAC,aAAa,CAAC,CAAC;YACzD,OAAO,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;SAC1C;IACL,CAAC,CAAC;IAGF,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE;QACrC,MAAM,GAAG,KAAK,CAAC;QACf,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC,CAAC;IAGH,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ const slugify = function (s) {
2
+ return encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, '-'));
3
+ };
4
+ export { slugify };
5
+ //# sourceMappingURL=slugify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slugify.js","sourceRoot":"","sources":["../../../../src/plugins/toc/slugify.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,UAAU,CAAC;IACvB,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AACnF,CAAC,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=toc-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toc-item.js","sourceRoot":"","sources":["../../../../src/plugins/toc/toc-item.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { slugify } from './slugify';
2
+ const defaultTocOption = {
3
+ includeLevel: [1, 2, 3, 4, 5, 6],
4
+ containerClass: 'toc',
5
+ slugify: slugify,
6
+ markerPattern: /\[TOC]/im,
7
+ listType: 'ul',
8
+ format: (content, md) => {
9
+ return md.renderInline(content).replace(/<\/?a.*?>/g, '');
10
+ },
11
+ forceFullToc: false,
12
+ containerHeaderHtml: `<div class="toc-container-header">目录</div>`,
13
+ containerFooterHtml: undefined,
14
+ transformLink: undefined,
15
+ };
16
+ export { defaultTocOption };
17
+ //# sourceMappingURL=toc-option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toc-option.js","sourceRoot":"","sources":["../../../../src/plugins/toc/toc-option.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,MAAM,gBAAgB,GAAG;IACrB,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAChC,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,OAAO;IAChB,aAAa,EAAE,UAAU;IACzB,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE;QACpB,OAAO,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,YAAY,EAAE,KAAK;IACnB,mBAAmB,EAAE,4CAA4C;IACjE,mBAAmB,EAAE,SAAS;IAC9B,aAAa,EAAE,SAAS;CAC3B,CAAC;AAEF,OAAO,EAAa,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/@types/mdurl/encode.d.ts","../../node_modules/@types/mdurl/decode.d.ts","../../node_modules/@types/mdurl/parse.d.ts","../../node_modules/@types/mdurl/format.d.ts","../../node_modules/@types/mdurl/index.d.ts","../../node_modules/@types/markdown-it/lib/common/utils.d.ts","../../node_modules/@types/markdown-it/lib/token.d.ts","../../node_modules/@types/markdown-it/lib/rules_inline/state_inline.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_label.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_destination.d.ts","../../node_modules/@types/markdown-it/lib/helpers/parse_link_title.d.ts","../../node_modules/@types/markdown-it/lib/helpers/index.d.ts","../../node_modules/@types/markdown-it/lib/rules_core/state_core.d.ts","../../node_modules/@types/markdown-it/lib/renderer.d.ts","../../node_modules/@types/markdown-it/lib/ruler.d.ts","../../node_modules/@types/markdown-it/lib/parser_core.d.ts","../../node_modules/@types/markdown-it/lib/rules_block/state_block.d.ts","../../node_modules/@types/markdown-it/lib/parser_block.d.ts","../../node_modules/@types/markdown-it/lib/parser_inline.d.ts","../../node_modules/@types/linkify-it/index.d.ts","../../node_modules/@types/markdown-it/lib/index.d.ts","../../node_modules/@types/markdown-it/index.d.ts","../../node_modules/highlight.js/types/index.d.ts","../../node_modules/@types/markdown-it-container/index.d.ts","../../node_modules/@types/markdown-it-anchor/index.d.ts","../../src/plugins/simple-math.plugin.ts","../../src/plugins/simple-mermaid.plugin.ts","../../src/plugins/html-filter.plugin.ts","../../src/plugins/multiline-blockquote/multiline-blockquote.rule.ts","../../src/plugins/multiline-blockquote/multiline-blockquote.plugin.ts","../../src/option.ts","../../src/plugins/toc/slugify.ts","../../src/plugins/toc/toc-option.ts","../../src/plugins/toc/toc-item.ts","../../src/plugins/toc/index.ts","../../src/plugins/highlight-code-lines.plugin.ts","../../src/plugins/meta.ts","../../src/markdown-it-factory.ts","../../src/index.ts","../../node_modules/@babel/types/lib/index.d.ts","../../node_modules/@types/babel__generator/index.d.ts","../../node_modules/@babel/parser/typings/babel-parser.d.ts","../../node_modules/@types/babel__template/index.d.ts","../../node_modules/@types/babel__traverse/index.d.ts","../../node_modules/@types/babel__core/index.d.ts","../../node_modules/@types/eslint/helpers.d.ts","../../node_modules/@types/estree/index.d.ts","../../node_modules/@types/json-schema/index.d.ts","../../node_modules/@types/eslint/index.d.ts","../../node_modules/@types/eslint-scope/index.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/assert/strict.d.ts","../../node_modules/@types/node/globals.d.ts","../../node_modules/@types/node/async_hooks.d.ts","../../node_modules/@types/node/buffer.d.ts","../../node_modules/@types/node/child_process.d.ts","../../node_modules/@types/node/cluster.d.ts","../../node_modules/@types/node/console.d.ts","../../node_modules/@types/node/constants.d.ts","../../node_modules/@types/node/crypto.d.ts","../../node_modules/@types/node/dgram.d.ts","../../node_modules/@types/node/diagnostics_channel.d.ts","../../node_modules/@types/node/dns.d.ts","../../node_modules/@types/node/dns/promises.d.ts","../../node_modules/@types/node/domain.d.ts","../../node_modules/@types/node/events.d.ts","../../node_modules/@types/node/fs.d.ts","../../node_modules/@types/node/fs/promises.d.ts","../../node_modules/@types/node/http.d.ts","../../node_modules/@types/node/http2.d.ts","../../node_modules/@types/node/https.d.ts","../../node_modules/@types/node/inspector.d.ts","../../node_modules/@types/node/module.d.ts","../../node_modules/@types/node/net.d.ts","../../node_modules/@types/node/os.d.ts","../../node_modules/@types/node/path.d.ts","../../node_modules/@types/node/perf_hooks.d.ts","../../node_modules/@types/node/process.d.ts","../../node_modules/@types/node/punycode.d.ts","../../node_modules/@types/node/querystring.d.ts","../../node_modules/@types/node/readline.d.ts","../../node_modules/@types/node/repl.d.ts","../../node_modules/@types/node/stream.d.ts","../../node_modules/@types/node/stream/promises.d.ts","../../node_modules/@types/node/stream/consumers.d.ts","../../node_modules/@types/node/stream/web.d.ts","../../node_modules/@types/node/string_decoder.d.ts","../../node_modules/@types/node/test.d.ts","../../node_modules/@types/node/timers.d.ts","../../node_modules/@types/node/timers/promises.d.ts","../../node_modules/@types/node/tls.d.ts","../../node_modules/@types/node/trace_events.d.ts","../../node_modules/@types/node/tty.d.ts","../../node_modules/@types/node/url.d.ts","../../node_modules/@types/node/util.d.ts","../../node_modules/@types/node/v8.d.ts","../../node_modules/@types/node/vm.d.ts","../../node_modules/@types/node/wasi.d.ts","../../node_modules/@types/node/worker_threads.d.ts","../../node_modules/@types/node/zlib.d.ts","../../node_modules/@types/node/globals.global.d.ts","../../node_modules/@types/node/index.d.ts","../../node_modules/@types/graceful-fs/index.d.ts","../../node_modules/@types/highlight.js/index.d.ts","../../node_modules/@types/istanbul-lib-coverage/index.d.ts","../../node_modules/@types/istanbul-lib-report/index.d.ts","../../node_modules/@types/istanbul-reports/index.d.ts","../../node_modules/jest-diff/build/cleanupSemantic.d.ts","../../node_modules/jest-diff/build/types.d.ts","../../node_modules/jest-diff/build/diffLines.d.ts","../../node_modules/jest-diff/build/printDiffs.d.ts","../../node_modules/jest-diff/build/index.d.ts","../../node_modules/pretty-format/build/types.d.ts","../../node_modules/pretty-format/build/index.d.ts","../../node_modules/@types/jest/index.d.ts","../../node_modules/@types/katex/contrib/auto-render.d.ts","../../node_modules/@types/katex/contrib/katex2tex.d.ts","../../node_modules/@types/katex/contrib/index.d.ts","../../node_modules/@types/katex/index.d.ts","../../node_modules/@types/normalize-package-data/index.d.ts","../../node_modules/@types/parse-json/index.d.ts","../../node_modules/@types/prettier/index.d.ts","../../node_modules/@types/stack-utils/index.d.ts","../../node_modules/@types/yargs-parser/index.d.ts","../../node_modules/@types/yargs/index.d.ts"],"fileInfos":[{"version":"f5c28122bee592cfaf5c72ed7bcc47f453b79778ffa6e301f45d21a0970719d4","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"3f149f903dd20dfeb7c80e228b659f0e436532de772469980dbd00702cc05cc1","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"cd483c056da900716879771893a3c9772b66c3c88f8943b4205aec738a94b1d0","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"c37f8a49593a0030eecb51bbfa270e709bec9d79a6cc3bb851ef348d4e6b26f8","affectsGlobalScope":true},"f313731860257325f13351575f381fef333d4dfe30daf5a2e72f894208feea08","951b37f7d86f6012f09e6b35f1de57c69d75f16908cb0adaa56b93675ea0b853","3816fc03ffd9cbd1a7a3362a264756a4a1d547caabea50ca68303046be40e376","0c417b4ec46b88fb62a43ec00204700b560d01eb5677c7faa8ecd34610f096a8","13d29cdeb64e8496424edf42749bbb47de5e42d201cf958911a4638cbcffbd3f","0f9e381eecc5860f693c31fe463b3ca20a64ca9b8db0cf6208cd4a053f064809","95902d5561c6aac5dfc40568a12b0aca324037749dcd32a81f23423bfde69bab","5dfb2aca4136abdc5a2740f14be8134a6e6b66fd53470bb2e954e40f8abfaf3e","577463167dd69bd81f76697dfc3f7b22b77a6152f60a602a9218e52e3183ad67","b8396e9024d554b611cbe31a024b176ba7116063d19354b5a02dccd8f0118989","4b28e1c5bf88d891e07a1403358b81a51b3ba2eae1ffada51cca7476b5ac6407","7150ad575d28bf98fae321a1c0f10ad17b127927811f488ded6ff1d88d4244e5","aeacac2778c9821512b6b889da79ac31606a863610c8f28da1e483579627bf90","1bfc796c6c20aafe9cb98077dc3419883e6b0cba0598ba8c64f4303c13dc4d8b","6c0ef7bda253648e46440b926d89c8f905e5d86fb0f15b145449213360f97bb0","ac6e057d5bf3209ee5317c0200dba6ac85fb596487a8651a95d31f22466811b9","93733466609dd8bf72eace502a24ca7574bd073d934216e628f1b615c8d3cb3c","7934e7d1fde97790436fec30d9d53f8286c83338f0810ef130f0bf014083a9a1","bf9876e62fb7f4237deafab8c7444770ef6e82b4cad2d5dc768664ff340feeb2","6503fb6addf62f9b10f8564d9869ad824565a914ec1ac3dd7d13da14a3f57036","0283a4047e6dd18ec1936b8fec4f17802e314406ad2f296372a543d7723c9b0a","c91ba82d33a6bb590d72fcd93f2201d4b7c140d58609f0e79833f5cbfaa8c977","e70dd5f565b1e3ae1e7bf24d5419ca2c89fae3ae4bff8cb7fb90470dbcbc9229","5dd7086833dbba11060b3941bc3a1c01bf71ec7ef69415e41031878e7e894ace","b443ee730204b584e11c3947f29c78707075687bf9c8551af068dbcff39b03b2","3d3012873aff5d3f7e8aba2393d9bca67b689eb3f463bad41732ed7df5638ac3","87ca383855e93789f1e9cdf7ffc1efaea71099f506bc2d1c6919fb534926f644","d79c36d7f68eeb59ad168b877b6079e3a525bb722f8fd4831f56f5a733a66c4c","fd125e50542a1fc18cf7c9d9e7b9a5495705610a77ff1a643a069dbae3dc0fe7","63de6080c666035bd1669660edf49362d32b088f8cf657944930f4acfef71b86","4002bf6543c53f0be77aa6203cc761efa44006d6885536e4a380e138089c538a","c3e407de82dfe0027cc926aa3e093877c0d318219dbbe129a3ef1f412cc3ce47","406fbf96d34da6a37e266e4cb05ef2a86d21974df9ed2ec9ee03050367547d87","ff7a675919cac21db091bf4911280021e618f9af6496a20a618c8e69abe1d898","4f4e519c30976e8a9542c219f77b41d2a2a524652a97484149cb9438857478eb","b5fbd14269d91baaadb3d5e5bf5ae4166683fd0c5d14bd1a6d4af0363597b260","54ec2e2d5a30a1eba665fded21e6c7ba6a620b0a46934ef819baa70a29c8af22","beb3967b78e884d3eb26765657edeaa8caa248775692fc29573848077a7acc55","25fb623392b62adf726c54760d6057d7415d24556583f8444ad9dbc562fdfd65","9b6d2a9f610aac2dc6c3fcc45a90dbbde0411dd677bdc956d76f484f397640f1","cc957354aa3c94c9961ebf46282cfde1e81d107fc5785a61f62c67f1dd3ac2eb","a46a2e69d12afe63876ec1e58d70e5dbee6d3e74132f4468f570c3d69f809f1c","93de1c6dab503f053efe8d304cb522bb3a89feab8c98f307a674a4fae04773e9","fc72135da24040641388fb5f2c2a7a99aa5b962c0fa125bd96fabeec63dd2e63","5426e62886b7be7806312d31a00e8f7dccd6fe63ba9bbefe99ee2eab29cc48a3",{"version":"64d4b35c5456adf258d2cf56c341e203a073253f229ef3208fc0d5020253b241","affectsGlobalScope":true},"a1c79f857f5c7754e14c93949dad8cfefcd7df2ecc0dc9dd79a30fd493e28449","f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","c6297435733f252a9c0e2297fab3b58014b8fde5fa097a4102dae4e12522bccd","e050a0afcdbb269720a900c85076d18e0c1ab73e580202a2bf6964978181222a","9122ed7070e054b73ebab37c2373a196def2d90e7d1a9a7fcd9d46b0e51fae78","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"77f0b5c6a193a699c9f7d7fb0578e64e562d271afa740783665d2a827104a873","affectsGlobalScope":true},"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9",{"version":"3e4624c306340ad303cc536a07004e81336c3f088308a9e4a9f4c957a3cda2fd","affectsGlobalScope":true},"0c0cee62cb619aed81133b904f644515ba3064487002a7da83fd8aa07b1b4abd","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","34ec1daf3566f26c43dbab380af0de1aac29166e57e4f9ef379a2f154e0cb290","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","75ecef44f126e2ae018b4abbd85b6e8a2e2ba1638ebec56cc64274643ce3567b","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"249a2b90439cdfd51709539fbfa4dfe0791cbae6efce1e9b327ba8f8cd703f49","affectsGlobalScope":true},"acc8fa7e1d03f0d8c4af03c75027086d80bf1cb17edd2d71313bee7bd12dfb91","a9b6b0f7b1e30359283b131ba6d1c51ee2d3601a2f12e1623141e6a1a60c92a5","aeee0090b38de0dd47ca9a79ad5c2d156e3e09d92306719b0b45a3e96098e564","7bac475dcdd9f7e4e9da934d32c305bc889c4ce3c8ac0ef45a93a8d670fff607","09416dd69576b03a3f485adf329a02f043e4a481e060ef5b208194e488d31fd9","8acf99b1c8682276a63ea5bb68433782715892726b97e4604a415e4e56bce41c",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"3b145a2351f5cf16abf999c8d5f4481c74dffdc54ec1e9a89992e2622e1226c5","a907bf91df26df2400858ef75f749498fb5cf00062bf90a737ac3949cc07978d","cb92bc2e42b261e4299025756f1beb826b3d9666a3f0d46f8a7254ca512f57e4","4275d5f964e7fc7afc18538e26b3748c207dd772998346d17f409749aa1f3a63",{"version":"59a638a504490fecaacf0020b9814b6abee37edb66047eb1ab9f7c2274bf1da0","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","d1a78a3c5708807e8de3e399f91df4797c62e44b02195eefc2209b2e713e54ee","8c4c1a64db28930732033c31418f817dcb9d09d706766707ae6d38f23faf0c53","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","556bf5c36deb62cffa1bf697c1789fe008ec82db0273025001db66732714e9d9","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","653968fc1b35c5eb3d273d36fac1c1dc66f9537edf28f33485b8776bd956e23d",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","a381f079c4804442f179d742fdb2e495fe28d67a47cac673485f75ae2e77aeca","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"bfe39beb986d2a2e512c091cbe924f1c415bc65de54de0e2f6a0dc6f84c183d9","affectsGlobalScope":true},"2af17363f8a062e3a8cd1b26030af0058b3f86e783f4fc6aa9f57247f240ebaa","06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","dfe08140492cdc135fb7fd9c4a652c05207b61a436906079b87da1d3111314bf","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa","089e1f8603cbc35ab977c8dcc662eb754b82fca32ed1dfb16bd682726c2d5432","8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"64d5585e08ad1ab194b18bf4e851f22a626eae33ac7312ca4ba90bb7ea7daf64","3ebae8c00411116a66fca65b08228ea0cf0b72724701f9b854442100aab55aba","21a2fa3722dc0baba2649e040c3121eb38ce84f5afe35ff1c20276132eaa2f2c","8b06ac3faeacb8484d84ddb44571d8f410697f98d7bfa86c0fda60373a9f5215","7eb06594824ada538b1d8b48c3925a83e7db792f47a081a62cf3e5c4e23cf0ee","f5638f7c2f12a9a1a57b5c41b3c1ea7db3876c003bab68e6a57afd6bcc169af0","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","69da61a7b5093dac77fa3bec8be95dcf9a74c95a0e9161edb98bb24e30e439d2","561eca7a381b96d6ccac6e4061e6d2ae53f5bc44203f3fd9f5b26864c32ae6e9","62ea38627e3ebab429f7616812a9394d327c2bc271003dfba985de9b4137369f","b4439890c168d646357928431100daac5cbdee1d345a34e6bf6eca9f3abe22bc","5d72971a459517c44c1379dab9ed248e87a61ba0a1e0f25c9d67e1e640cd9a09","02d734976af36f4273d930bea88b3e62adf6b078cf120c1c63d49aa8d8427c5c",{"version":"516a426e3960379f310107635b8f3a7e8c307c6c665080b128039d9299ec4087","affectsGlobalScope":true},"d5233d3816d390f80493f4e678f3437b5af677452e6401e8e23641108339b9e0","1ced83d3606cfe4a0d2d98c24873b4147ac4c1b9beacb1d1dd0d8bacd3a00220","42c7f325d2075cf80f65ef6225692605b6516602209175d29281c7a53838d28f","f667b528eae7dbdd854691d8f654e33f664e0a6054fdd696fced817c778fc7f1","6fa0008bf91a4cc9c8963bace4bba0bd6865cbfa29c3e3ccc461155660fb113a","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b","89877326fed87fa9601cf958e3af77d5901e24c1ba9a4099f69325f0c0e39b0a","b0d10e46cfe3f6c476b69af02eaa38e4ccc7430221ce3109ae84bb9fb8282298","70e9a18da08294f75bf23e46c7d69e67634c0765d355887b9b41f0d959e1426e","09c4b2e2d3070239d563fc690f0cc5db04a2d9b66a23e61aef8b5274e3e9910c"],"options":{"declaration":false,"declarationMap":false,"esModuleInterop":true,"module":5,"outDir":"./","removeComments":true,"sourceMap":true,"target":2},"fileIdsList":[[81,136],[136],[81,82,83,84,85,136],[81,83,136],[88,90,136],[87,88,89,136],[108,136,143],[136,146],[136,147],[136,153,155],[136,160],[136,157,158],[136,159],[48,57,63,136],[48,55,63,136],[62,136],[46,136],[50,51,52,136],[49,136],[51,136],[46,47,48,53,54,55,57,59,60,61,120,136],[48,56,58,62,136],[48,54,56,62,136],[48,49,56,62,136],[48,62,136],[54,136],[42,43,44,45,136],[92,136],[95,136],[96,101,136],[97,107,108,115,124,135,136],[97,98,107,115,136],[99,136],[100,101,108,116,136],[101,124,132,136],[102,104,107,115,136],[103,136],[104,105,136],[106,107,136],[107,136],[107,108,109,124,135,136],[107,108,109,124,127,136],[136,140],[110,115,124,135,136],[107,108,110,111,115,124,132,135,136],[110,112,124,132,135,136],[92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142],[107,113,136],[114,135,136],[104,107,115,124,136],[116,136],[117,136],[95,118,136],[119,134,136,140],[120,136],[121,136],[107,122,136],[122,123,136,138],[107,124,125,126,127,136],[124,126,136],[124,125,136],[127,136],[128,136],[107,130,131,136],[130,131,136],[101,115,124,132,136],[133,136],[115,134,136],[96,110,121,135,136],[101,136],[124,136,137],[136,138],[136,139],[96,101,107,109,118,124,135,136,138,140],[124,136,141],[136,165],[64,136],[136,149,150],[136,149,150,151,152],[136,154],[79,136],[48,61,63,64,65,66,67,68,69,71,72,76,77,78,136],[61,66,136],[48,63,136],[63,136],[59,136],[63,70,136],[48,58,59,136],[49,55,57,58,59,60,63,136],[48,54,60,63,74,75,136],[63,73,136]],"referencedMap":[[83,1],[81,2],[86,3],[82,1],[84,4],[85,1],[91,5],[87,2],[90,6],[88,2],[144,7],[145,2],[146,2],[147,8],[148,9],[156,10],[89,2],[157,11],[159,12],[158,2],[160,13],[61,2],[66,14],[65,15],[63,16],[47,17],[53,18],[51,2],[50,19],[52,20],[62,21],[59,22],[57,23],[60,24],[55,25],[56,26],[58,25],[54,25],[49,25],[48,2],[43,2],[42,2],[45,17],[46,27],[44,17],[92,28],[93,28],[95,29],[96,30],[97,31],[98,32],[99,33],[100,34],[101,35],[102,36],[103,37],[104,38],[105,38],[106,39],[107,40],[108,41],[109,42],[94,43],[142,2],[110,44],[111,45],[112,46],[143,47],[113,48],[114,49],[115,50],[116,51],[117,52],[118,53],[119,54],[120,55],[121,56],[122,57],[123,58],[124,59],[126,60],[125,61],[127,62],[128,63],[129,2],[130,64],[131,65],[132,66],[133,67],[134,68],[135,69],[136,70],[137,71],[138,72],[139,73],[140,74],[141,75],[161,2],[162,2],[163,2],[164,2],[165,2],[166,76],[64,77],[149,2],[151,78],[153,79],[152,78],[150,2],[155,80],[154,2],[8,2],[10,2],[9,2],[2,2],[11,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[3,2],[4,2],[22,2],[19,2],[20,2],[21,2],[23,2],[24,2],[25,2],[5,2],[26,2],[27,2],[28,2],[29,2],[6,2],[30,2],[31,2],[32,2],[33,2],[7,2],[34,2],[39,2],[40,2],[35,2],[36,2],[37,2],[38,2],[1,2],[41,2],[80,81],[79,82],[72,83],[77,84],[69,85],[78,86],[71,87],[70,88],[67,89],[68,84],[76,90],[73,2],[75,2],[74,91]],"exportedModulesMap":[[83,1],[81,2],[86,3],[82,1],[84,4],[85,1],[91,5],[87,2],[90,6],[88,2],[144,7],[145,2],[146,2],[147,8],[148,9],[156,10],[89,2],[157,11],[159,12],[158,2],[160,13],[61,2],[66,14],[65,15],[63,16],[47,17],[53,18],[51,2],[50,19],[52,20],[62,21],[59,22],[57,23],[60,24],[55,25],[56,26],[58,25],[54,25],[49,25],[48,2],[43,2],[42,2],[45,17],[46,27],[44,17],[92,28],[93,28],[95,29],[96,30],[97,31],[98,32],[99,33],[100,34],[101,35],[102,36],[103,37],[104,38],[105,38],[106,39],[107,40],[108,41],[109,42],[94,43],[142,2],[110,44],[111,45],[112,46],[143,47],[113,48],[114,49],[115,50],[116,51],[117,52],[118,53],[119,54],[120,55],[121,56],[122,57],[123,58],[124,59],[126,60],[125,61],[127,62],[128,63],[129,2],[130,64],[131,65],[132,66],[133,67],[134,68],[135,69],[136,70],[137,71],[138,72],[139,73],[140,74],[141,75],[161,2],[162,2],[163,2],[164,2],[165,2],[166,76],[64,77],[149,2],[151,78],[153,79],[152,78],[150,2],[155,80],[154,2],[8,2],[10,2],[9,2],[2,2],[11,2],[12,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[3,2],[4,2],[22,2],[19,2],[20,2],[21,2],[23,2],[24,2],[25,2],[5,2],[26,2],[27,2],[28,2],[29,2],[6,2],[30,2],[31,2],[32,2],[33,2],[7,2],[34,2],[39,2],[40,2],[35,2],[36,2],[37,2],[38,2],[1,2],[41,2],[80,81],[79,82],[72,83],[77,84],[69,85],[78,86],[71,87],[70,88],[67,89],[68,84],[76,90],[73,2],[75,2],[74,91]],"semanticDiagnosticsPerFile":[83,81,86,82,84,85,91,87,90,88,144,145,146,147,148,156,89,157,159,158,160,61,66,65,63,47,53,51,50,52,62,59,57,60,55,56,58,54,49,48,43,42,45,46,44,92,93,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,94,142,110,111,112,143,113,114,115,116,117,118,119,120,121,122,123,124,126,125,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,161,162,163,164,165,166,64,149,151,153,152,150,155,154,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,30,31,32,33,7,34,39,40,35,36,37,38,1,41,80,79,72,77,69,78,71,70,67,68,76,73,75,74]},"version":"4.7.4"}
@@ -0,0 +1,5 @@
1
+ import MarkdownIt from 'markdown-it';
2
+ import { MultilineBlockquotePlugin } from './plugins/multiline-blockquote/multiline-blockquote.plugin';
3
+ import { MarkdownItPresetOption } from './option';
4
+ declare const markdownItFactory: ({ html, codeHighlight, taskListsOption, math, disableRules, linkify: linkifyOption, }?: MarkdownItPresetOption) => MarkdownIt;
5
+ export { MultilineBlockquotePlugin, markdownItFactory };
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.markdownItFactory = exports.MultilineBlockquotePlugin = void 0;
7
+ const markdown_it_1 = __importDefault(require("markdown-it"));
8
+ const highlight_js_1 = __importDefault(require("highlight.js"));
9
+ const markdown_it_container_1 = __importDefault(require("markdown-it-container"));
10
+ const markdown_it_abbr_1 = __importDefault(require("markdown-it-abbr"));
11
+ const markdown_it_deflist_1 = __importDefault(require("markdown-it-deflist"));
12
+ const markdown_it_emoji_1 = __importDefault(require("markdown-it-emoji"));
13
+ const markdown_it_footnote_1 = __importDefault(require("markdown-it-footnote"));
14
+ const markdown_it_mark_1 = __importDefault(require("markdown-it-mark"));
15
+ const markdown_it_sub_1 = __importDefault(require("markdown-it-sub"));
16
+ const markdown_it_sup_1 = __importDefault(require("markdown-it-sup"));
17
+ const markdown_it_anchor_1 = __importDefault(require("markdown-it-anchor"));
18
+ const markdown_it_lazy_headers_1 = __importDefault(require("markdown-it-lazy-headers"));
19
+ const markdown_it_for_inline_1 = __importDefault(require("markdown-it-for-inline"));
20
+ const markdown_it_task_lists_1 = __importDefault(require("markdown-it-task-lists"));
21
+ const simple_math_plugin_1 = require("./plugins/simple-math.plugin");
22
+ const simple_mermaid_plugin_1 = require("./plugins/simple-mermaid.plugin");
23
+ const html_filter_plugin_1 = require("./plugins/html-filter.plugin");
24
+ const multiline_blockquote_plugin_1 = require("./plugins/multiline-blockquote/multiline-blockquote.plugin");
25
+ Object.defineProperty(exports, "MultilineBlockquotePlugin", { enumerable: true, get: function () { return multiline_blockquote_plugin_1.MultilineBlockquotePlugin; } });
26
+ const option_1 = require("./option");
27
+ const toc_1 = require("./plugins/toc");
28
+ const highlight_code_lines_plugin_1 = require("./plugins/highlight-code-lines.plugin");
29
+ const meta_1 = require("./plugins/meta");
30
+ const mdUtils = new markdown_it_1.default().utils;
31
+ const defaultCodeHighlight = (str, lang) => {
32
+ if (lang && highlight_js_1.default.getLanguage(lang)) {
33
+ try {
34
+ const result = highlight_js_1.default.highlight(lang, str, true);
35
+ return `<pre class="hljs"><code data-lang="${result.language}">${result.value}</code></pre>`;
36
+ }
37
+ catch (_a) { }
38
+ }
39
+ return `<pre class="hljs"><code>${mdUtils.escapeHtml(str)}</code></pre>`;
40
+ };
41
+ const addLinkAttributes = [
42
+ markdown_it_for_inline_1.default,
43
+ 'url_new_win',
44
+ 'link_open',
45
+ (tokens, idx) => {
46
+ const token = tokens[idx];
47
+ const href = token.attrGet('href');
48
+ if (!href) {
49
+ return;
50
+ }
51
+ if (!href.startsWith('#')) {
52
+ token.attrPush(['target', '_blank']);
53
+ }
54
+ },
55
+ ];
56
+ const markdownItFactory = ({ html, codeHighlight, taskListsOption, math, disableRules, linkify: linkifyOption, } = option_1.defaultMarkdownItOption) => {
57
+ const mdOpt = {
58
+ html: html,
59
+ breaks: true,
60
+ linkify: true,
61
+ };
62
+ taskListsOption !== null && taskListsOption !== void 0 ? taskListsOption : (taskListsOption = option_1.defaultTaskListsOption);
63
+ linkifyOption = Object.assign({}, option_1.defaultLinkifyOptions, linkifyOption !== null && linkifyOption !== void 0 ? linkifyOption : option_1.defaultLinkifyOptions);
64
+ if (codeHighlight) {
65
+ mdOpt.highlight = defaultCodeHighlight;
66
+ }
67
+ const md = new markdown_it_1.default(mdOpt)
68
+ .use(markdown_it_container_1.default)
69
+ .use(simple_mermaid_plugin_1.diagramPlugin)
70
+ .use(markdown_it_anchor_1.default, option_1.anchorOption)
71
+ .use(toc_1.TocPlugin)
72
+ .use(markdown_it_abbr_1.default)
73
+ .use(markdown_it_deflist_1.default)
74
+ .use(markdown_it_emoji_1.default)
75
+ .use(markdown_it_footnote_1.default)
76
+ .use(markdown_it_mark_1.default)
77
+ .use(markdown_it_sub_1.default)
78
+ .use(markdown_it_sup_1.default)
79
+ .use(highlight_code_lines_plugin_1.MdHighlightCodeLines)
80
+ .use(markdown_it_lazy_headers_1.default)
81
+ .use(markdown_it_task_lists_1.default, taskListsOption)
82
+ .use(html_filter_plugin_1.HtmlFilterPlugin)
83
+ .use(...addLinkAttributes)
84
+ .use(multiline_blockquote_plugin_1.MultilineBlockquotePlugin);
85
+ md.block.ruler.before('hr', 'meta', meta_1.meta);
86
+ if (math) {
87
+ md.use(simple_math_plugin_1.simpleMathPlugin);
88
+ }
89
+ if (disableRules && disableRules.length > 0) {
90
+ md.disable(disableRules);
91
+ }
92
+ const { normalize: defaultNormalize } = md.linkify.set(linkifyOption);
93
+ if (linkifyOption.fuzzyLink && linkifyOption.fuzzyLinkUseHttps) {
94
+ md.linkify.normalize = ((match) => {
95
+ if (!match.schema) {
96
+ match.url = `https://${match.url}`;
97
+ return;
98
+ }
99
+ defaultNormalize(match);
100
+ });
101
+ }
102
+ return md;
103
+ };
104
+ exports.markdownItFactory = markdownItFactory;
105
+ //# sourceMappingURL=markdown-it-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-it-factory.js","sourceRoot":"","sources":["../src/markdown-it-factory.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA2D;AAC3D,gEAAgC;AAChC,kFAAwD;AACxD,wEAAsC;AACtC,8EAA4C;AAC5C,0EAAwC;AACxC,gFAA8C;AAC9C,wEAAsC;AACtC,sEAAoC;AACpC,sEAAoC;AACpC,4EAA0C;AAC1C,wFAAmD;AACnD,oFAA0D;AAC1D,oFAAuD;AAEvD,qEAAgE;AAChE,2EAAgE;AAEhE,qEAAgE;AAChE,4GAAuG;AAsG9F,0GAtGA,uDAAyB,OAsGA;AArGlC,qCAMkB;AAClB,uCAA0C;AAC1C,uFAA6E;AAC7E,yCAAsC;AAEtC,MAAM,OAAO,GAAG,IAAI,qBAAU,EAAE,CAAC,KAAK,CAAC;AAEvC,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;IACvC,IAAI,IAAI,IAAI,sBAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;QAChC,IAAI;YACA,MAAM,MAAM,GAAG,sBAAI,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAA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K,CAAC,CAAC;QACrC,CAAC,CAAQ,CAAC;KACb;IAED,OAAO,EAAE,CAAC;AACd,CAAC,CAAC;AAEkC,8CAAiB"}
package/option.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import MdAnchor from 'markdown-it-anchor';
2
+ interface TaskListsOption {
3
+ enable: boolean;
4
+ label: boolean;
5
+ labelAfter: boolean;
6
+ }
7
+ declare type LinkifyOption = import('linkify-it').Options & {
8
+ fuzzyLinkUseHttps?: boolean;
9
+ };
10
+ interface MarkdownItPresetOption {
11
+ codeHighlight: boolean;
12
+ math: boolean;
13
+ html: boolean;
14
+ disableRules: string[];
15
+ taskListsOption?: TaskListsOption;
16
+ linkify?: LinkifyOption;
17
+ }
18
+ declare const defaultTaskListsOption: TaskListsOption;
19
+ declare const defaultMarkdownItOption: MarkdownItPresetOption;
20
+ declare const defaultLinkifyOptions: LinkifyOption;
21
+ declare const anchorOption: MdAnchor.AnchorOptions;
22
+ export { TaskListsOption, MarkdownItPresetOption, defaultTaskListsOption, defaultMarkdownItOption, defaultLinkifyOptions, anchorOption, };
package/option.js ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.anchorOption = exports.defaultLinkifyOptions = exports.defaultMarkdownItOption = exports.defaultTaskListsOption = void 0;
7
+ const github_slugger_1 = __importDefault(require("github-slugger"));
8
+ const defaultTaskListsOption = {
9
+ enable: true,
10
+ label: true,
11
+ labelAfter: true,
12
+ };
13
+ exports.defaultTaskListsOption = defaultTaskListsOption;
14
+ const defaultMarkdownItOption = {
15
+ codeHighlight: false,
16
+ math: false,
17
+ disableRules: [],
18
+ html: false,
19
+ taskListsOption: defaultTaskListsOption,
20
+ };
21
+ exports.defaultMarkdownItOption = defaultMarkdownItOption;
22
+ const defaultLinkifyOptions = {
23
+ fuzzyEmail: false,
24
+ fuzzyLink: false,
25
+ fuzzyLinkUseHttps: true,
26
+ };
27
+ exports.defaultLinkifyOptions = defaultLinkifyOptions;
28
+ const anchorOption = {
29
+ level: 1,
30
+ slugify(str) {
31
+ const result = new github_slugger_1.default().slug(str);
32
+ return result === '' ? '_' : result;
33
+ },
34
+ };
35
+ exports.anchorOption = anchorOption;
36
+ //# sourceMappingURL=option.js.map
package/option.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"option.js","sourceRoot":"","sources":["../src/option.ts"],"names":[],"mappings":";;;;;;AACA,oEAA2C;AAmC3C,MAAM,sBAAsB,GAAoB;IAC5C,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;CACnB,CAAC;AA2BE,wDAAsB;AAzB1B,MAAM,uBAAuB,GAA2B;IACpD,aAAa,EAAE,KAAK;IACpB,IAAI,EAAE,KAAK;IACX,YAAY,EAAE,EAAE;IAChB,IAAI,EAAE,KAAK;IACX,eAAe,EAAE,sBAAsB;CAC1C,CAAC;AAoBE,0DAAuB;AAlB3B,MAAM,qBAAqB,GAAkB;IACzC,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,KAAK;IAChB,iBAAiB,EAAE,IAAI;CAC1B,CAAC;AAeE,sDAAqB;AAbzB,MAAM,YAAY,GAA2B;IACzC,KAAK,EAAE,CAAC;IACR,OAAO,CAAC,GAAW;QACf,MAAM,MAAM,GAAG,IAAI,wBAAa,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7C,OAAO,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;IACxC,CAAC;CACJ,CAAC;AAQE,oCAAY"}
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@cnblogs/markdown-it-presets",
3
+ "version": "1.5.8",
4
+ "description": "Markdown-it configuation for cnblogs.com",
5
+ "repository": "git@github.com:cnblogs-team/packages.git",
6
+ "main": "index.js",
7
+ "license": "MIT",
8
+ "exports": {
9
+ "./*": "./*",
10
+ ".": "./lib-esm/index.js"
11
+ },
12
+ "scripts": {
13
+ "build": "shx rm -rf ./dist && npm run build:umd && npm run build:tsc && npm run build:lib-esm && shx cp ./package.json ./dist/ && shx cp -r ./src/styles ./dist && shx mv ./dist/umd/styles/** ./dist/styles/ && shx rm -rf ./dist/umd/styles",
14
+ "build:umd": "webpack --config webpack.config.js && shx rm -rf ./dist/umd/styles/*.js",
15
+ "build:tsc": "tsc --build tsconfig.build.json",
16
+ "build:lib-esm": "tsc -p tsconfig.build.json -m es6 --declaration false --declarationMap false -m es6 --outDir dist/lib-esm",
17
+ "inspect": "webpack --config webpack.config.js --profile --json > dist/umd/stats.json && webpack-bundle-analyzer dist/umd/stats.json",
18
+ "test": "jest",
19
+ "format": "prettier --write ."
20
+ },
21
+ "dependencies": {
22
+ "github-slugger": "^1.3.0",
23
+ "markdown-it": "npm:@cnblogs-gitlab/markdown-it@^12.1.0",
24
+ "markdown-it-abbr": "^1.0.4",
25
+ "markdown-it-anchor": "^6.0.1",
26
+ "markdown-it-container": "^3.0.0",
27
+ "markdown-it-deflist": "^2.1.0",
28
+ "markdown-it-emoji": "^2.0.0",
29
+ "markdown-it-footnote": "^3.0.2",
30
+ "markdown-it-for-inline": "^0.1.1",
31
+ "markdown-it-lazy-headers": "^0.1.3",
32
+ "markdown-it-mark": "^3.0.0",
33
+ "markdown-it-sub": "^1.0.0",
34
+ "markdown-it-sup": "^1.0.0",
35
+ "markdown-it-task-lists": "npm:@cnblogs-gitlab/markdown-it-task-lists@^2.1.3"
36
+ },
37
+ "devDependencies": {
38
+ "@babel/core": "^7.12.9",
39
+ "@babel/preset-env": "^7.12.7",
40
+ "@babel/preset-typescript": "^7.12.7",
41
+ "@cnblogs-gitlab/prettier-config": "^2.0.1",
42
+ "@types/babel__core": "^7.1.12",
43
+ "@types/jest": "^26.0.17",
44
+ "@types/katex": "^0.11.0",
45
+ "@types/markdown-it": "^10.0.3",
46
+ "@types/markdown-it-anchor": "^4.0.4",
47
+ "@types/markdown-it-container": "^2.0.3",
48
+ "babel-loader": "^8.2.2",
49
+ "css-loader": "^6.5.1",
50
+ "css-minimizer-webpack-plugin": "^3.4.1",
51
+ "highlight.js": "^11.5.1",
52
+ "jest": "^26.6.3",
53
+ "less": "^4.1.2",
54
+ "less-loader": "^10.2.0",
55
+ "mini-css-extract-plugin": "^2.5.3",
56
+ "postcss": "^8.4.5",
57
+ "postcss-loader": "^7.0.1",
58
+ "prettier": "^2.5.1",
59
+ "shx": "^0.3.4",
60
+ "ts-jest": "^26.4.4",
61
+ "typescript": "^4.6.4",
62
+ "webpack": "^5.10.0",
63
+ "webpack-bundle-analyzer": "^4.2.0",
64
+ "webpack-cli": "^4.2.0"
65
+ },
66
+ "peerDependencies": {
67
+ "highlight.js": ">=11.0.0 < 12.0.0"
68
+ },
69
+ "browserslist": [
70
+ "> 0.25%, not dead"
71
+ ],
72
+ "publishConfig": {
73
+ "@cnblogs-team:registry": "https://npm.pkg.github.com/",
74
+ "@cnblogs-gitlab:registry": "https://gitlab.cnblogs.com/api/v4/projects/371/packages/npm/",
75
+ "@cnblogs:registry": "https://registry.npmjs.org/"
76
+ }
77
+ }
@@ -0,0 +1,3 @@
1
+ import { PluginSimple } from 'markdown-it';
2
+ declare const highlightCodeLines: PluginSimple;
3
+ export { highlightCodeLines as MdHighlightCodeLines };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MdHighlightCodeLines = void 0;
4
+ const lineNumbersRegex = /{([\d,\s-]+)}/;
5
+ const highlightCodeLines = md => {
6
+ const fence = md.renderer.rules.fence;
7
+ md.renderer.rules.fence = (tokens, idx, options, env, self) => {
8
+ const token = tokens[idx];
9
+ if (!token.info || !lineNumbersRegex.test(token.info)) {
10
+ return fence(tokens, idx, options, env, self);
11
+ }
12
+ let highlightedLines = [];
13
+ try {
14
+ highlightedLines = Array.from(new Set(lineNumbersRegex
15
+ .exec(token.info)[1]
16
+ .split(/\s*?,\s*?/)
17
+ .map(v => {
18
+ let [start, end] = v.split(/\s*?-\s*?/).map(v => parseInt(v.trim(), 10));
19
+ start = start > 0 ? start : 1;
20
+ end = end > start ? end : start;
21
+ const paddedArr = new Array((start > end ? start - end : end - start) + 1).fill(0);
22
+ paddedArr.forEach((_, idx) => {
23
+ paddedArr[idx] = start + idx;
24
+ });
25
+ return paddedArr;
26
+ })
27
+ .flat()));
28
+ }
29
+ catch (ex) {
30
+ console.warn(ex);
31
+ }
32
+ const langName = token.info.replace(lineNumbersRegex, '').trim();
33
+ let code = md.utils.escapeHtml(token.content);
34
+ code = options.highlight ? options.highlight(code, langName) : code;
35
+ const tmpToken = Object.assign(token, {
36
+ attrs: [
37
+ ['class', langName ? `language-${langName}` : ''],
38
+ highlightedLines && highlightedLines.length > 0
39
+ ? ['data-lines-highlight', `[${highlightedLines.join(',')}]`]
40
+ : [],
41
+ ],
42
+ });
43
+ const attrs = self.renderAttrs(tmpToken);
44
+ return `<pre${attrs}><code${attrs}>${code.trim()}</code></pre>`;
45
+ };
46
+ };
47
+ exports.MdHighlightCodeLines = highlightCodeLines;
48
+ //# sourceMappingURL=highlight-code-lines.plugin.js.map