@readme/markdown 11.7.0 → 11.7.2

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/main.node.js CHANGED
@@ -1,10 +1,329 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 3368:
5
- /***/ ((module) => {
4
+ /***/ 9762:
5
+ /***/ ((__unused_webpack_module, exports) => {
6
+
7
+ "use strict";
8
+
9
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10
+ const modeAliases = {
11
+ aspx: 'asp',
12
+ bash: 'shell',
13
+ 'c++': 'cplusplus',
14
+ 'c#': 'csharp',
15
+ clj: 'clojure',
16
+ cljc: 'clojure',
17
+ cljx: 'clojure',
18
+ coffeescript: 'javascript',
19
+ cpp: 'cplusplus',
20
+ cql: 'sql',
21
+ cs: 'csharp',
22
+ docker: 'dockerfile',
23
+ ecmascript: 'javascript',
24
+ erl: 'erlang',
25
+ gql: 'graphql',
26
+ gradle: 'groovy',
27
+ handlebars: 'html',
28
+ hbs: 'html',
29
+ jl: 'julia',
30
+ jruby: 'ruby',
31
+ js: 'javascript',
32
+ kt: 'kotlin',
33
+ less: 'css',
34
+ macruby: 'ruby',
35
+ md: 'markdown',
36
+ ml: 'ocaml',
37
+ mssql: 'sql',
38
+ mysql: 'sql',
39
+ node: 'javascript',
40
+ 'obj-c': 'objectivec',
41
+ 'obj-c++': 'objectivecplusplus',
42
+ 'objc++': 'objectivecplusplus',
43
+ objc: 'objectivec',
44
+ objcpp: 'objectivecplusplus',
45
+ objectivecpp: 'objectivecplusplus',
46
+ pgsql: 'sql',
47
+ pl: 'perl',
48
+ plsql: 'sql',
49
+ postgres: 'sql',
50
+ postgresql: 'sql',
51
+ ps1: 'powershell',
52
+ py: 'python',
53
+ rake: 'ruby',
54
+ rb: 'ruby',
55
+ rbx: 'ruby',
56
+ rs: 'rust',
57
+ sass: 'css',
58
+ scss: 'css',
59
+ sh: 'shell',
60
+ solidity: 'sol',
61
+ sqlite: 'sql',
62
+ styl: 'css',
63
+ stylus: 'css',
64
+ xhtml: 'html',
65
+ yml: 'yaml',
66
+ zsh: 'shell',
67
+ };
68
+ const canonical = (language) => {
69
+ if (language in modeAliases)
70
+ return modeAliases[language];
71
+ return language;
72
+ };
73
+ exports["default"] = canonical;
74
+
75
+
76
+ /***/ }),
77
+
78
+ /***/ 7900:
79
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
80
+
81
+ "use strict";
82
+
83
+ var __importDefault = (this && this.__importDefault) || function (mod) {
84
+ return (mod && mod.__esModule) ? mod : { "default": mod };
85
+ };
86
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
87
+ const canonical_1 = __importDefault(__webpack_require__(9762));
88
+ const modes_1 = __webpack_require__(1412);
89
+ const uppercase_1 = __importDefault(__webpack_require__(8892));
90
+ exports["default"] = { uppercase: uppercase_1.default, canonical: canonical_1.default, modes: modes_1.modes, getMode: modes_1.getMode };
91
+
92
+
93
+ /***/ }),
94
+
95
+ /***/ 1412:
96
+ /***/ ((__unused_webpack_module, exports) => {
97
+
98
+ "use strict";
99
+
100
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
101
+ exports.modes = void 0;
102
+ exports.getMode = getMode;
103
+ // This is a mapping of languages that we support, but aren't directly loading the mode extension
104
+ // Within `/src/codeMirror/index.jsx` and /src/codeEditor.index.jsx
105
+ //
106
+ // This list also includes a number of language aliases, as because of the way we're using
107
+ // `CodeMirror.runMode` we can't take advantage of its known aliases in the mode extensions that
108
+ // we're loading.
109
+ //
110
+ // There are 2 types of lookup, single and array. e.g. `html` needs to be rendered using
111
+ // `htmlmixed`, but `java`, needs to be rendered using the `clike` mode.
112
+ //
113
+ exports.modes = {
114
+ asp: 'clike',
115
+ aspx: 'clike',
116
+ bash: 'shell',
117
+ c: 'clike',
118
+ 'c#': ['clike', 'text/x-csharp'],
119
+ 'c++': ['clike', 'text/x-c++src'],
120
+ clj: 'clojure',
121
+ cljc: 'clojure',
122
+ cljx: 'clojure',
123
+ coffeescript: 'javascript',
124
+ cplusplus: ['clike', 'text/x-c++src'],
125
+ cpp: ['clike', 'text/x-c++src'],
126
+ cql: ['sql', 'text/x-cassandra'],
127
+ cs: ['clike', 'text/x-csharp'],
128
+ csharp: ['clike', 'text/x-csharp'],
129
+ curl: 'shell',
130
+ d: 'd',
131
+ diff: 'diff',
132
+ ecmascript: 'javascript',
133
+ erl: 'erlang',
134
+ go: ['go', 'text/x-go'],
135
+ gradle: 'groovy',
136
+ gql: 'graphql',
137
+ handlebars: 'htmlmixed',
138
+ hbs: 'htmlmixed',
139
+ html: 'htmlmixed',
140
+ java: ['clike', 'text/x-java'],
141
+ jl: 'julia',
142
+ js: 'javascript',
143
+ jsx: 'jsx',
144
+ json: ['javascript', 'application/ld+json'],
145
+ jruby: 'ruby',
146
+ kotlin: ['clike', 'text/x-kotlin'],
147
+ kt: ['clike', 'text/x-kotlin'],
148
+ less: 'css',
149
+ liquid: 'htmlmixed',
150
+ lua: 'lua',
151
+ node: 'javascript',
152
+ macruby: 'ruby',
153
+ markdown: 'gfm',
154
+ ml: ['mllike', 'text/x-ocaml'],
155
+ mssql: ['sql', 'text/x-mssql'],
156
+ mysql: ['sql', 'text/x-mysql'],
157
+ objc: ['clike', 'text/x-objectivec'],
158
+ 'objc++': ['clike', 'text/x-objectivec++'],
159
+ objcpp: ['clike', 'text/x-objectivec++'],
160
+ objectivec: ['clike', 'text/x-objectivec'],
161
+ objectivecpp: ['clike', 'text/x-objectivec++'],
162
+ objectivecplusplus: ['clike', 'text/x-objectivec++'],
163
+ ocaml: ['mllike', 'text/x-ocaml'],
164
+ php: ['php', 'text/x-php'],
165
+ pgsql: ['sql', 'text/x-pgsql'],
166
+ pl: 'perl',
167
+ plsql: ['sql', 'text/x-plsql'],
168
+ postgres: ['sql', 'text/x-pgsql'],
169
+ postgresql: ['sql', 'text/x-pgsql'],
170
+ ps1: 'powershell',
171
+ py: 'python',
172
+ r: 'r',
173
+ rake: 'ruby',
174
+ rb: 'ruby',
175
+ rbx: 'ruby',
176
+ rs: 'rust',
177
+ sass: 'css',
178
+ scala: ['clike', 'text/x-scala'],
179
+ scss: 'css',
180
+ sh: 'shell',
181
+ sol: 'solidity',
182
+ solidity: 'solidity',
183
+ sql: ['sql', 'text/x-sql'],
184
+ sqlite: ['sql', 'text/x-sqlite'],
185
+ styl: 'css',
186
+ stylus: 'css',
187
+ text: ['null', 'text/plain'],
188
+ ts: ['javascript', 'text/typescript'],
189
+ typescript: ['javascript', 'text/typescript'],
190
+ xhtml: 'htmlmixed',
191
+ yml: 'yaml',
192
+ zsh: 'shell',
193
+ };
194
+ function getMode(lang) {
195
+ let mode = lang;
196
+ if (mode in exports.modes) {
197
+ mode = exports.modes[mode];
198
+ if (Array.isArray(mode)) {
199
+ [, mode] = mode;
200
+ }
201
+ }
202
+ return mode;
203
+ }
204
+
205
+
206
+ /***/ }),
207
+
208
+ /***/ 8892:
209
+ /***/ ((__unused_webpack_module, exports) => {
210
+
211
+ "use strict";
212
+
213
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
214
+ exports["default"] = uppercase;
215
+ const codeTypes = {
216
+ asp: 'ASP.NET',
217
+ aspx: 'ASP.NET',
218
+ bash: 'Bash',
219
+ c: 'C',
220
+ 'c#': 'C#',
221
+ 'c++': 'C++',
222
+ coffeescript: 'CoffeeScript',
223
+ clj: 'Clojure',
224
+ cljc: 'Clojure',
225
+ cljx: 'Clojure',
226
+ clojure: 'Clojure',
227
+ cplusplus: 'C++',
228
+ cpp: 'C++',
229
+ cql: 'Cassandra',
230
+ cs: 'C#',
231
+ csharp: 'C#',
232
+ css: 'CSS',
233
+ curl: 'cURL',
234
+ d: 'D',
235
+ dart: 'Dart',
236
+ diff: 'Diff',
237
+ dockerfile: 'Dockerfile',
238
+ ecmascript: 'ECMAScript',
239
+ erl: 'Erlang',
240
+ erlang: 'Erlang',
241
+ go: 'Go',
242
+ gql: 'GraphQL',
243
+ gradle: 'Gradle',
244
+ graphql: 'GraphQL',
245
+ groovy: 'Groovy',
246
+ handlebars: 'Handlebars',
247
+ hbs: 'Handlebars',
248
+ haml: 'HAML',
249
+ haxe: 'Haxe',
250
+ html: 'HTML',
251
+ http: 'HTTP',
252
+ java: 'Java',
253
+ javascript: 'JavaScript',
254
+ jinja2: 'Jinja2',
255
+ jl: 'Julia',
256
+ jruby: 'JRuby',
257
+ js: 'JavaScript',
258
+ json: 'JSON',
259
+ jsx: 'JSX',
260
+ julia: 'Julia',
261
+ kotlin: 'Kotlin',
262
+ kt: 'Kotlin',
263
+ less: 'LESS',
264
+ liquid: 'Liquid',
265
+ lua: 'Lua',
266
+ macruby: 'MacRuby',
267
+ markdown: 'Markdown',
268
+ md: 'Markdown',
269
+ mermaid: 'Mermaid', // syntax highlighting not supported yet
270
+ ml: 'OCaml',
271
+ mssql: 'SQL Server',
272
+ mysql: 'MySQL',
273
+ node: 'Node',
274
+ objc: 'Objective-C',
275
+ 'objc++': 'Objective-C++',
276
+ objcpp: 'Objective-C++',
277
+ objectivec: 'Objective-C',
278
+ objectivecpp: 'Objective-C++',
279
+ objectivecplusplus: 'Objective-C++',
280
+ ocaml: 'OCaml',
281
+ perl: 'Perl',
282
+ php: 'PHP',
283
+ pl: 'Perl',
284
+ pgsql: 'PL/pgSQL',
285
+ plsql: 'PL/SQL',
286
+ postgres: 'PostgreSQL',
287
+ postgresql: 'PostgreSQL',
288
+ powershell: 'PowerShell',
289
+ ps1: 'PowerShell',
290
+ python: 'Python',
291
+ py: 'Python',
292
+ r: 'R',
293
+ rake: 'Rake',
294
+ rb: 'Ruby',
295
+ rbx: 'Rubinius',
296
+ rs: 'Rust',
297
+ ruby: 'Ruby',
298
+ rust: 'Rust',
299
+ sass: 'Sass',
300
+ scala: 'Scala',
301
+ scss: 'SCSS',
302
+ sh: 'Shell',
303
+ shell: 'Shell',
304
+ smarty: 'Smarty',
305
+ solidity: 'Solidity',
306
+ sql: 'SQL',
307
+ sqlite: 'SQLite',
308
+ stylus: 'Stylus',
309
+ styl: 'Stylus',
310
+ swift: 'Swift',
311
+ text: 'Text',
312
+ toml: 'TOML',
313
+ twig: 'Twig',
314
+ typescript: 'TypeScript',
315
+ xhtml: 'XHTML',
316
+ xml: 'XML',
317
+ yaml: 'YAML',
318
+ yml: 'YAML',
319
+ zsh: 'Zsh',
320
+ };
321
+ function uppercase(language) {
322
+ if (language in codeTypes)
323
+ return codeTypes[language];
324
+ return language;
325
+ }
6
326
 
7
- (()=>{var e={226:e=>{var l={aspx:"asp",bash:"shell","c++":"cplusplus","c#":"csharp",clj:"clojure",cljc:"clojure",cljx:"clojure",coffeescript:"javascript",cpp:"cplusplus",cql:"sql",cs:"csharp",docker:"dockerfile",ecmascript:"javascript",erl:"erlang",gql:"graphql",gradle:"groovy",handlebars:"html",hbs:"html",jl:"julia",jruby:"ruby",js:"javascript",kt:"kotlin",less:"css",macruby:"ruby",md:"markdown",ml:"ocaml",mssql:"sql",mysql:"sql",node:"javascript","obj-c":"objectivec","obj-c++":"objectivecplusplus","objc++":"objectivecplusplus",objc:"objectivec",objcpp:"objectivecplusplus",objectivecpp:"objectivecplusplus",pgsql:"sql",pl:"perl",plsql:"sql",postgres:"sql",postgresql:"sql",ps1:"powershell",py:"python",rake:"ruby",rb:"ruby",rbx:"ruby",rs:"rust",sass:"css",scss:"css",sh:"shell",solidity:"sol",sqlite:"sql",styl:"css",stylus:"css",xhtml:"html",yml:"yaml",zsh:"shell"};e.exports=function(e){return e in l?l[e]:e}},548:e=>{var l={asp:"ASP.NET",aspx:"ASP.NET",bash:"Bash",c:"C","c#":"C#","c++":"C++",coffeescript:"CoffeeScript",clj:"Clojure",cljc:"Clojure",cljx:"Clojure",clojure:"Clojure",cplusplus:"C++",cpp:"C++",cql:"Cassandra",cs:"C#",csharp:"C#",css:"CSS",curl:"cURL",d:"D",dart:"Dart",diff:"Diff",dockerfile:"Dockerfile",ecmascript:"ECMAScript",erl:"Erlang",erlang:"Erlang",go:"Go",gql:"GraphQL",gradle:"Gradle",graphql:"GraphQL",groovy:"Groovy",handlebars:"Handlebars",hbs:"Handlebars",haml:"HAML",haxe:"Haxe",html:"HTML",http:"HTTP",java:"Java",javascript:"JavaScript",jinja2:"Jinja2",jl:"Julia",jruby:"JRuby",js:"JavaScript",json:"JSON",jsx:"JSX",julia:"Julia",kotlin:"Kotlin",kt:"Kotlin",less:"LESS",liquid:"Liquid",lua:"Lua",macruby:"MacRuby",markdown:"Markdown",md:"Markdown",mermaid:"Mermaid",ml:"OCaml",mssql:"SQL Server",mysql:"MySQL",node:"Node",objc:"Objective-C","objc++":"Objective-C++",objcpp:"Objective-C++",objectivec:"Objective-C",objectivecpp:"Objective-C++",objectivecplusplus:"Objective-C++",ocaml:"OCaml",perl:"Perl",php:"PHP",pl:"Perl",pgsql:"PL/pgSQL",plsql:"PL/SQL",postgres:"PostgreSQL",postgresql:"PostgreSQL",powershell:"PowerShell",ps1:"PowerShell",python:"Python",py:"Python",r:"R",rake:"Rake",rb:"Ruby",rbx:"Rubinius",rs:"Rust",ruby:"Ruby",rust:"Rust",sass:"Sass",scala:"Scala",scss:"SCSS",sh:"Shell",shell:"Shell",smarty:"Smarty",solidity:"Solidity",sql:"SQL",sqlite:"SQLite",stylus:"Stylus",styl:"Stylus",swift:"Swift",text:"Text",toml:"TOML",twig:"Twig",typescript:"TypeScript",xhtml:"XHTML",xml:"XML",yaml:"YAML",yml:"YAML",zsh:"Zsh"};e.exports=function(e){return e in l?l[e]:e}},980:e=>{function l(e,l){return function(e){if(Array.isArray(e))return e}(e)||function(e,l){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var s,r,c,a,o=[],i=!0,p=!1;try{if(c=(t=t.call(e)).next,0===l){if(Object(t)!==t)return;i=!1}else for(;!(i=(s=c.call(t)).done)&&(o.push(s.value),o.length!==l);i=!0);}catch(e){p=!0,r=e}finally{try{if(!i&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(p)throw r}}return o}}(e,l)||function(e,l){if(e){if("string"==typeof e)return t(e,l);var s={}.toString.call(e).slice(8,-1);return"Object"===s&&e.constructor&&(s=e.constructor.name),"Map"===s||"Set"===s?Array.from(e):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?t(e,l):void 0}}(e,l)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,l){(null==l||l>e.length)&&(l=e.length);for(var t=0,s=Array(l);t<l;t++)s[t]=e[t];return s}var s={asp:"clike",aspx:"clike",bash:"shell",c:"clike","c#":["clike","text/x-csharp"],"c++":["clike","text/x-c++src"],clj:"clojure",cljc:"clojure",cljx:"clojure",coffeescript:"javascript",cplusplus:["clike","text/x-c++src"],cpp:["clike","text/x-c++src"],cql:["sql","text/x-cassandra"],cs:["clike","text/x-csharp"],csharp:["clike","text/x-csharp"],curl:"shell",d:"d",diff:"diff",ecmascript:"javascript",erl:"erlang",go:["go","text/x-go"],gradle:"groovy",gql:"graphql",handlebars:"htmlmixed",hbs:"htmlmixed",html:"htmlmixed",java:["clike","text/x-java"],jl:"julia",js:"javascript",jsx:"jsx",json:["javascript","application/ld+json"],jruby:"ruby",kotlin:["clike","text/x-kotlin"],kt:["clike","text/x-kotlin"],less:"css",liquid:"htmlmixed",lua:"lua",node:"javascript",macruby:"ruby",markdown:"gfm",ml:["mllike","text/x-ocaml"],mssql:["sql","text/x-mssql"],mysql:["sql","text/x-mysql"],objc:["clike","text/x-objectivec"],"objc++":["clike","text/x-objectivec++"],objcpp:["clike","text/x-objectivec++"],objectivec:["clike","text/x-objectivec"],objectivecpp:["clike","text/x-objectivec++"],objectivecplusplus:["clike","text/x-objectivec++"],ocaml:["mllike","text/x-ocaml"],php:["php","text/x-php"],pgsql:["sql","text/x-pgsql"],pl:"perl",plsql:["sql","text/x-plsql"],postgres:["sql","text/x-pgsql"],postgresql:["sql","text/x-pgsql"],ps1:"powershell",py:"python",r:"r",rake:"ruby",rb:"ruby",rbx:"ruby",rs:"rust",sass:"css",scala:["clike","text/x-scala"],scss:"css",sh:"shell",sol:"solidity",solidity:"solidity",sql:["sql","text/x-sql"],sqlite:["sql","text/x-sqlite"],styl:"css",stylus:"css",text:["null","text/plain"],ts:["javascript","text/typescript"],typescript:["javascript","text/typescript"],xhtml:"htmlmixed",yml:"yaml",zsh:"shell"};e.exports={modes:s,getMode:function(e){var t=e;return t in s&&(t=s[t],Array.isArray(t)&&(t=l(t,2)[1])),t}}}},l={};function t(s){var r=l[s];if(void 0!==r)return r.exports;var c=l[s]={exports:{}};return e[s](c,c.exports,t),c.exports}t.n=e=>{var l=e&&e.__esModule?()=>e.default:()=>e;return t.d(l,{a:l}),l},t.d=(e,l)=>{for(var s in l)t.o(l,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:l[s]})},t.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};(()=>{"use strict";t.r(s),t.d(s,{canonical:()=>l.a,getMode:()=>r.getMode,modes:()=>r.modes,uppercase:()=>a.a});var e=t(226),l=t.n(e),r=t(980),c=t(548),a=t.n(c)})(),module.exports=s})();
8
327
 
9
328
  /***/ }),
10
329
 
@@ -16643,7 +16962,8 @@ let syntaxHighlighter;
16643
16962
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
16644
16963
  let canonicalLanguage = lang => '';
16645
16964
  if (typeof window !== 'undefined') {
16646
- Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 3368, 23)).then(module => {
16965
+ // @ts-expect-error this library does not have any types defined
16966
+ __webpack_require__.e(/* import() */ 368).then(__webpack_require__.t.bind(__webpack_require__, 3368, 23)).then(module => {
16647
16967
  syntaxHighlighter = module.default;
16648
16968
  canonicalLanguage = module.canonical;
16649
16969
  });
@@ -16686,13 +17006,15 @@ const Code = (props) => {
16686
17006
  };
16687
17007
  /* harmony default export */ const components_Code = (Code);
16688
17008
 
16689
- // EXTERNAL MODULE: ./node_modules/@readme/syntax-highlighter/dist/index.node.js
16690
- var index_node = __webpack_require__(3368);
17009
+ // EXTERNAL MODULE: ./node_modules/@readme/syntax-highlighter/dist-utils/index.js
17010
+ var dist_utils = __webpack_require__(7900);
17011
+ var dist_utils_default = /*#__PURE__*/__webpack_require__.n(dist_utils);
16691
17012
  ;// ./components/CodeTabs/index.tsx
16692
17013
 
16693
17014
 
16694
17015
 
16695
17016
  let mermaid;
17017
+ const { uppercase } = (dist_utils_default());
16696
17018
  const CodeTabs = (props) => {
16697
17019
  const { children } = props;
16698
17020
  const theme = (0,external_react_.useContext)(Theme);
@@ -16730,7 +17052,7 @@ const CodeTabs = (props) => {
16730
17052
  external_react_default().createElement("div", { className: "CodeTabs-toolbar" }, (Array.isArray(children) ? children : [children]).map((pre, i) => {
16731
17053
  const { meta, lang } = pre.props.children.props;
16732
17054
  /* istanbul ignore next */
16733
- return (external_react_default().createElement("button", { key: i, onClick: e => handleClick(e, i), type: "button", value: lang }, meta || `${!lang ? 'Text' : (0,index_node.uppercase)(lang)}`));
17055
+ return (external_react_default().createElement("button", { key: i, onClick: e => handleClick(e, i), type: "button", value: lang }, meta || `${!lang ? 'Text' : uppercase(lang)}`));
16734
17056
  })),
16735
17057
  external_react_default().createElement("div", { className: "CodeTabs-inner" }, children)));
16736
17058
  };
@@ -108320,23 +108642,62 @@ const stripCommentsTransformer = () => {
108320
108642
  };
108321
108643
  };
108322
108644
 
108645
+ ;// ./lib/utils/extractMagicBlocks.ts
108646
+ /**
108647
+ * The content matching in this regex captures everything between `[block:TYPE]`
108648
+ * and `[/block]`, including new lines. Negative lookahead for the closing
108649
+ * `[/block]` tag is required to prevent greedy matching to ensure it stops at
108650
+ * the first closing tag it encounters preventing vulnerability to polynomial
108651
+ * backtracking issues.
108652
+ */
108653
+ const MAGIC_BLOCK_REGEX = /\[block:[^\]]{1,100}\](?:(?!\[block:)(?!\[\/block\])[\s\S])*\[\/block\]/g;
108654
+ /**
108655
+ * Extract legacy magic block syntax from a markdown string.
108656
+ * Returns the modified markdown and an array of extracted blocks.
108657
+ */
108658
+ function extractMagicBlocks(markdown) {
108659
+ const blocks = [];
108660
+ let index = 0;
108661
+ const replaced = markdown.replace(MAGIC_BLOCK_REGEX, match => {
108662
+ // Use backticks so it becomes a code span, preventing remarkParse from
108663
+ // parsing special characters in the token as markdown syntax
108664
+ const token = `\`__MAGIC_BLOCK_${index}__\``;
108665
+ blocks.push({ token, raw: match });
108666
+ index += 1;
108667
+ return token;
108668
+ });
108669
+ return { replaced, blocks };
108670
+ }
108671
+ /**
108672
+ * Restore extracted magic blocks back into a markdown string.
108673
+ */
108674
+ function restoreMagicBlocks(replaced, blocks) {
108675
+ return blocks.reduce((acc, { token, raw }) => {
108676
+ return acc.split(token).join(raw);
108677
+ }, replaced);
108678
+ }
108679
+
108323
108680
  ;// ./lib/stripComments.ts
108324
108681
 
108325
108682
 
108326
108683
 
108327
108684
 
108328
108685
 
108686
+
108329
108687
  /**
108330
108688
  * Removes Markdown and MDX comments.
108331
108689
  */
108332
108690
  async function stripComments(doc, { mdx } = {}) {
108691
+ const { replaced, blocks } = extractMagicBlocks(doc);
108333
108692
  const processor = unified()
108334
108693
  .use(remarkParse)
108335
108694
  .use(mdx ? remarkMdx : undefined)
108336
108695
  .use(stripCommentsTransformer)
108337
108696
  .use(remarkStringify);
108338
- const file = await processor.process(doc);
108339
- return String(file);
108697
+ const file = await processor.process(replaced);
108698
+ const stringified = String(file).trim();
108699
+ const restored = restoreMagicBlocks(stringified, blocks);
108700
+ return restored;
108340
108701
  }
108341
108702
  /* harmony default export */ const lib_stripComments = (stripComments);
108342
108703