@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/components/Code/index.tsx +1 -0
- package/components/CodeTabs/index.tsx +3 -1
- package/dist/368.node.js +406 -0
- package/dist/368.node.js.map +1 -0
- package/dist/lib/utils/extractMagicBlocks.d.ts +17 -0
- package/dist/main.js +374 -6
- package/dist/main.node.js +370 -9
- package/dist/main.node.js.map +1 -1
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -11,6 +11,332 @@
|
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
+
/***/ 9762:
|
|
15
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
16
|
+
|
|
17
|
+
"use strict";
|
|
18
|
+
|
|
19
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
20
|
+
const modeAliases = {
|
|
21
|
+
aspx: 'asp',
|
|
22
|
+
bash: 'shell',
|
|
23
|
+
'c++': 'cplusplus',
|
|
24
|
+
'c#': 'csharp',
|
|
25
|
+
clj: 'clojure',
|
|
26
|
+
cljc: 'clojure',
|
|
27
|
+
cljx: 'clojure',
|
|
28
|
+
coffeescript: 'javascript',
|
|
29
|
+
cpp: 'cplusplus',
|
|
30
|
+
cql: 'sql',
|
|
31
|
+
cs: 'csharp',
|
|
32
|
+
docker: 'dockerfile',
|
|
33
|
+
ecmascript: 'javascript',
|
|
34
|
+
erl: 'erlang',
|
|
35
|
+
gql: 'graphql',
|
|
36
|
+
gradle: 'groovy',
|
|
37
|
+
handlebars: 'html',
|
|
38
|
+
hbs: 'html',
|
|
39
|
+
jl: 'julia',
|
|
40
|
+
jruby: 'ruby',
|
|
41
|
+
js: 'javascript',
|
|
42
|
+
kt: 'kotlin',
|
|
43
|
+
less: 'css',
|
|
44
|
+
macruby: 'ruby',
|
|
45
|
+
md: 'markdown',
|
|
46
|
+
ml: 'ocaml',
|
|
47
|
+
mssql: 'sql',
|
|
48
|
+
mysql: 'sql',
|
|
49
|
+
node: 'javascript',
|
|
50
|
+
'obj-c': 'objectivec',
|
|
51
|
+
'obj-c++': 'objectivecplusplus',
|
|
52
|
+
'objc++': 'objectivecplusplus',
|
|
53
|
+
objc: 'objectivec',
|
|
54
|
+
objcpp: 'objectivecplusplus',
|
|
55
|
+
objectivecpp: 'objectivecplusplus',
|
|
56
|
+
pgsql: 'sql',
|
|
57
|
+
pl: 'perl',
|
|
58
|
+
plsql: 'sql',
|
|
59
|
+
postgres: 'sql',
|
|
60
|
+
postgresql: 'sql',
|
|
61
|
+
ps1: 'powershell',
|
|
62
|
+
py: 'python',
|
|
63
|
+
rake: 'ruby',
|
|
64
|
+
rb: 'ruby',
|
|
65
|
+
rbx: 'ruby',
|
|
66
|
+
rs: 'rust',
|
|
67
|
+
sass: 'css',
|
|
68
|
+
scss: 'css',
|
|
69
|
+
sh: 'shell',
|
|
70
|
+
solidity: 'sol',
|
|
71
|
+
sqlite: 'sql',
|
|
72
|
+
styl: 'css',
|
|
73
|
+
stylus: 'css',
|
|
74
|
+
xhtml: 'html',
|
|
75
|
+
yml: 'yaml',
|
|
76
|
+
zsh: 'shell',
|
|
77
|
+
};
|
|
78
|
+
const canonical = (language) => {
|
|
79
|
+
if (language in modeAliases)
|
|
80
|
+
return modeAliases[language];
|
|
81
|
+
return language;
|
|
82
|
+
};
|
|
83
|
+
exports["default"] = canonical;
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
/***/ }),
|
|
87
|
+
|
|
88
|
+
/***/ 7900:
|
|
89
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
90
|
+
|
|
91
|
+
"use strict";
|
|
92
|
+
|
|
93
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
94
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
95
|
+
};
|
|
96
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
97
|
+
const canonical_1 = __importDefault(__webpack_require__(9762));
|
|
98
|
+
const modes_1 = __webpack_require__(1412);
|
|
99
|
+
const uppercase_1 = __importDefault(__webpack_require__(8892));
|
|
100
|
+
exports["default"] = { uppercase: uppercase_1.default, canonical: canonical_1.default, modes: modes_1.modes, getMode: modes_1.getMode };
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
/***/ }),
|
|
104
|
+
|
|
105
|
+
/***/ 1412:
|
|
106
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
107
|
+
|
|
108
|
+
"use strict";
|
|
109
|
+
|
|
110
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
111
|
+
exports.modes = void 0;
|
|
112
|
+
exports.getMode = getMode;
|
|
113
|
+
// This is a mapping of languages that we support, but aren't directly loading the mode extension
|
|
114
|
+
// Within `/src/codeMirror/index.jsx` and /src/codeEditor.index.jsx
|
|
115
|
+
//
|
|
116
|
+
// This list also includes a number of language aliases, as because of the way we're using
|
|
117
|
+
// `CodeMirror.runMode` we can't take advantage of its known aliases in the mode extensions that
|
|
118
|
+
// we're loading.
|
|
119
|
+
//
|
|
120
|
+
// There are 2 types of lookup, single and array. e.g. `html` needs to be rendered using
|
|
121
|
+
// `htmlmixed`, but `java`, needs to be rendered using the `clike` mode.
|
|
122
|
+
//
|
|
123
|
+
exports.modes = {
|
|
124
|
+
asp: 'clike',
|
|
125
|
+
aspx: 'clike',
|
|
126
|
+
bash: 'shell',
|
|
127
|
+
c: 'clike',
|
|
128
|
+
'c#': ['clike', 'text/x-csharp'],
|
|
129
|
+
'c++': ['clike', 'text/x-c++src'],
|
|
130
|
+
clj: 'clojure',
|
|
131
|
+
cljc: 'clojure',
|
|
132
|
+
cljx: 'clojure',
|
|
133
|
+
coffeescript: 'javascript',
|
|
134
|
+
cplusplus: ['clike', 'text/x-c++src'],
|
|
135
|
+
cpp: ['clike', 'text/x-c++src'],
|
|
136
|
+
cql: ['sql', 'text/x-cassandra'],
|
|
137
|
+
cs: ['clike', 'text/x-csharp'],
|
|
138
|
+
csharp: ['clike', 'text/x-csharp'],
|
|
139
|
+
curl: 'shell',
|
|
140
|
+
d: 'd',
|
|
141
|
+
diff: 'diff',
|
|
142
|
+
ecmascript: 'javascript',
|
|
143
|
+
erl: 'erlang',
|
|
144
|
+
go: ['go', 'text/x-go'],
|
|
145
|
+
gradle: 'groovy',
|
|
146
|
+
gql: 'graphql',
|
|
147
|
+
handlebars: 'htmlmixed',
|
|
148
|
+
hbs: 'htmlmixed',
|
|
149
|
+
html: 'htmlmixed',
|
|
150
|
+
java: ['clike', 'text/x-java'],
|
|
151
|
+
jl: 'julia',
|
|
152
|
+
js: 'javascript',
|
|
153
|
+
jsx: 'jsx',
|
|
154
|
+
json: ['javascript', 'application/ld+json'],
|
|
155
|
+
jruby: 'ruby',
|
|
156
|
+
kotlin: ['clike', 'text/x-kotlin'],
|
|
157
|
+
kt: ['clike', 'text/x-kotlin'],
|
|
158
|
+
less: 'css',
|
|
159
|
+
liquid: 'htmlmixed',
|
|
160
|
+
lua: 'lua',
|
|
161
|
+
node: 'javascript',
|
|
162
|
+
macruby: 'ruby',
|
|
163
|
+
markdown: 'gfm',
|
|
164
|
+
ml: ['mllike', 'text/x-ocaml'],
|
|
165
|
+
mssql: ['sql', 'text/x-mssql'],
|
|
166
|
+
mysql: ['sql', 'text/x-mysql'],
|
|
167
|
+
objc: ['clike', 'text/x-objectivec'],
|
|
168
|
+
'objc++': ['clike', 'text/x-objectivec++'],
|
|
169
|
+
objcpp: ['clike', 'text/x-objectivec++'],
|
|
170
|
+
objectivec: ['clike', 'text/x-objectivec'],
|
|
171
|
+
objectivecpp: ['clike', 'text/x-objectivec++'],
|
|
172
|
+
objectivecplusplus: ['clike', 'text/x-objectivec++'],
|
|
173
|
+
ocaml: ['mllike', 'text/x-ocaml'],
|
|
174
|
+
php: ['php', 'text/x-php'],
|
|
175
|
+
pgsql: ['sql', 'text/x-pgsql'],
|
|
176
|
+
pl: 'perl',
|
|
177
|
+
plsql: ['sql', 'text/x-plsql'],
|
|
178
|
+
postgres: ['sql', 'text/x-pgsql'],
|
|
179
|
+
postgresql: ['sql', 'text/x-pgsql'],
|
|
180
|
+
ps1: 'powershell',
|
|
181
|
+
py: 'python',
|
|
182
|
+
r: 'r',
|
|
183
|
+
rake: 'ruby',
|
|
184
|
+
rb: 'ruby',
|
|
185
|
+
rbx: 'ruby',
|
|
186
|
+
rs: 'rust',
|
|
187
|
+
sass: 'css',
|
|
188
|
+
scala: ['clike', 'text/x-scala'],
|
|
189
|
+
scss: 'css',
|
|
190
|
+
sh: 'shell',
|
|
191
|
+
sol: 'solidity',
|
|
192
|
+
solidity: 'solidity',
|
|
193
|
+
sql: ['sql', 'text/x-sql'],
|
|
194
|
+
sqlite: ['sql', 'text/x-sqlite'],
|
|
195
|
+
styl: 'css',
|
|
196
|
+
stylus: 'css',
|
|
197
|
+
text: ['null', 'text/plain'],
|
|
198
|
+
ts: ['javascript', 'text/typescript'],
|
|
199
|
+
typescript: ['javascript', 'text/typescript'],
|
|
200
|
+
xhtml: 'htmlmixed',
|
|
201
|
+
yml: 'yaml',
|
|
202
|
+
zsh: 'shell',
|
|
203
|
+
};
|
|
204
|
+
function getMode(lang) {
|
|
205
|
+
let mode = lang;
|
|
206
|
+
if (mode in exports.modes) {
|
|
207
|
+
mode = exports.modes[mode];
|
|
208
|
+
if (Array.isArray(mode)) {
|
|
209
|
+
[, mode] = mode;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return mode;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
/***/ }),
|
|
217
|
+
|
|
218
|
+
/***/ 8892:
|
|
219
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
220
|
+
|
|
221
|
+
"use strict";
|
|
222
|
+
|
|
223
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
224
|
+
exports["default"] = uppercase;
|
|
225
|
+
const codeTypes = {
|
|
226
|
+
asp: 'ASP.NET',
|
|
227
|
+
aspx: 'ASP.NET',
|
|
228
|
+
bash: 'Bash',
|
|
229
|
+
c: 'C',
|
|
230
|
+
'c#': 'C#',
|
|
231
|
+
'c++': 'C++',
|
|
232
|
+
coffeescript: 'CoffeeScript',
|
|
233
|
+
clj: 'Clojure',
|
|
234
|
+
cljc: 'Clojure',
|
|
235
|
+
cljx: 'Clojure',
|
|
236
|
+
clojure: 'Clojure',
|
|
237
|
+
cplusplus: 'C++',
|
|
238
|
+
cpp: 'C++',
|
|
239
|
+
cql: 'Cassandra',
|
|
240
|
+
cs: 'C#',
|
|
241
|
+
csharp: 'C#',
|
|
242
|
+
css: 'CSS',
|
|
243
|
+
curl: 'cURL',
|
|
244
|
+
d: 'D',
|
|
245
|
+
dart: 'Dart',
|
|
246
|
+
diff: 'Diff',
|
|
247
|
+
dockerfile: 'Dockerfile',
|
|
248
|
+
ecmascript: 'ECMAScript',
|
|
249
|
+
erl: 'Erlang',
|
|
250
|
+
erlang: 'Erlang',
|
|
251
|
+
go: 'Go',
|
|
252
|
+
gql: 'GraphQL',
|
|
253
|
+
gradle: 'Gradle',
|
|
254
|
+
graphql: 'GraphQL',
|
|
255
|
+
groovy: 'Groovy',
|
|
256
|
+
handlebars: 'Handlebars',
|
|
257
|
+
hbs: 'Handlebars',
|
|
258
|
+
haml: 'HAML',
|
|
259
|
+
haxe: 'Haxe',
|
|
260
|
+
html: 'HTML',
|
|
261
|
+
http: 'HTTP',
|
|
262
|
+
java: 'Java',
|
|
263
|
+
javascript: 'JavaScript',
|
|
264
|
+
jinja2: 'Jinja2',
|
|
265
|
+
jl: 'Julia',
|
|
266
|
+
jruby: 'JRuby',
|
|
267
|
+
js: 'JavaScript',
|
|
268
|
+
json: 'JSON',
|
|
269
|
+
jsx: 'JSX',
|
|
270
|
+
julia: 'Julia',
|
|
271
|
+
kotlin: 'Kotlin',
|
|
272
|
+
kt: 'Kotlin',
|
|
273
|
+
less: 'LESS',
|
|
274
|
+
liquid: 'Liquid',
|
|
275
|
+
lua: 'Lua',
|
|
276
|
+
macruby: 'MacRuby',
|
|
277
|
+
markdown: 'Markdown',
|
|
278
|
+
md: 'Markdown',
|
|
279
|
+
mermaid: 'Mermaid', // syntax highlighting not supported yet
|
|
280
|
+
ml: 'OCaml',
|
|
281
|
+
mssql: 'SQL Server',
|
|
282
|
+
mysql: 'MySQL',
|
|
283
|
+
node: 'Node',
|
|
284
|
+
objc: 'Objective-C',
|
|
285
|
+
'objc++': 'Objective-C++',
|
|
286
|
+
objcpp: 'Objective-C++',
|
|
287
|
+
objectivec: 'Objective-C',
|
|
288
|
+
objectivecpp: 'Objective-C++',
|
|
289
|
+
objectivecplusplus: 'Objective-C++',
|
|
290
|
+
ocaml: 'OCaml',
|
|
291
|
+
perl: 'Perl',
|
|
292
|
+
php: 'PHP',
|
|
293
|
+
pl: 'Perl',
|
|
294
|
+
pgsql: 'PL/pgSQL',
|
|
295
|
+
plsql: 'PL/SQL',
|
|
296
|
+
postgres: 'PostgreSQL',
|
|
297
|
+
postgresql: 'PostgreSQL',
|
|
298
|
+
powershell: 'PowerShell',
|
|
299
|
+
ps1: 'PowerShell',
|
|
300
|
+
python: 'Python',
|
|
301
|
+
py: 'Python',
|
|
302
|
+
r: 'R',
|
|
303
|
+
rake: 'Rake',
|
|
304
|
+
rb: 'Ruby',
|
|
305
|
+
rbx: 'Rubinius',
|
|
306
|
+
rs: 'Rust',
|
|
307
|
+
ruby: 'Ruby',
|
|
308
|
+
rust: 'Rust',
|
|
309
|
+
sass: 'Sass',
|
|
310
|
+
scala: 'Scala',
|
|
311
|
+
scss: 'SCSS',
|
|
312
|
+
sh: 'Shell',
|
|
313
|
+
shell: 'Shell',
|
|
314
|
+
smarty: 'Smarty',
|
|
315
|
+
solidity: 'Solidity',
|
|
316
|
+
sql: 'SQL',
|
|
317
|
+
sqlite: 'SQLite',
|
|
318
|
+
stylus: 'Stylus',
|
|
319
|
+
styl: 'Stylus',
|
|
320
|
+
swift: 'Swift',
|
|
321
|
+
text: 'Text',
|
|
322
|
+
toml: 'TOML',
|
|
323
|
+
twig: 'Twig',
|
|
324
|
+
typescript: 'TypeScript',
|
|
325
|
+
xhtml: 'XHTML',
|
|
326
|
+
xml: 'XML',
|
|
327
|
+
yaml: 'YAML',
|
|
328
|
+
yml: 'YAML',
|
|
329
|
+
zsh: 'Zsh',
|
|
330
|
+
};
|
|
331
|
+
function uppercase(language) {
|
|
332
|
+
if (language in codeTypes)
|
|
333
|
+
return codeTypes[language];
|
|
334
|
+
return language;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
/***/ }),
|
|
339
|
+
|
|
14
340
|
/***/ 9214:
|
|
15
341
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
16
342
|
|
|
@@ -8620,7 +8946,7 @@ module.exports = { nanoid, customAlphabet }
|
|
|
8620
8946
|
/******/ };
|
|
8621
8947
|
/******/
|
|
8622
8948
|
/******/ // Execute the module function
|
|
8623
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
8949
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
8624
8950
|
/******/
|
|
8625
8951
|
/******/ // Return the exports of the module
|
|
8626
8952
|
/******/ return module.exports;
|
|
@@ -8974,6 +9300,7 @@ let syntaxHighlighter;
|
|
|
8974
9300
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8975
9301
|
let canonicalLanguage = lang => '';
|
|
8976
9302
|
if (typeof window !== 'undefined') {
|
|
9303
|
+
// @ts-expect-error this library does not have any types defined
|
|
8977
9304
|
Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 3966, 23)).then(module => {
|
|
8978
9305
|
syntaxHighlighter = module.default;
|
|
8979
9306
|
canonicalLanguage = module.canonical;
|
|
@@ -9017,13 +9344,15 @@ const Code = (props) => {
|
|
|
9017
9344
|
};
|
|
9018
9345
|
/* harmony default export */ const components_Code = (Code);
|
|
9019
9346
|
|
|
9020
|
-
// EXTERNAL MODULE:
|
|
9021
|
-
var
|
|
9347
|
+
// EXTERNAL MODULE: ./node_modules/@readme/syntax-highlighter/dist-utils/index.js
|
|
9348
|
+
var dist_utils = __webpack_require__(7900);
|
|
9349
|
+
var dist_utils_default = /*#__PURE__*/__webpack_require__.n(dist_utils);
|
|
9022
9350
|
;// ./components/CodeTabs/index.tsx
|
|
9023
9351
|
|
|
9024
9352
|
|
|
9025
9353
|
|
|
9026
9354
|
let mermaid;
|
|
9355
|
+
const { uppercase } = (dist_utils_default());
|
|
9027
9356
|
const CodeTabs = (props) => {
|
|
9028
9357
|
const { children } = props;
|
|
9029
9358
|
const theme = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useContext)(Theme);
|
|
@@ -9061,7 +9390,7 @@ const CodeTabs = (props) => {
|
|
|
9061
9390
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "CodeTabs-toolbar" }, (Array.isArray(children) ? children : [children]).map((pre, i) => {
|
|
9062
9391
|
const { meta, lang } = pre.props.children.props;
|
|
9063
9392
|
/* istanbul ignore next */
|
|
9064
|
-
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("button", { key: i, onClick: e => handleClick(e, i), type: "button", value: lang }, meta || `${!lang ? 'Text' :
|
|
9393
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("button", { key: i, onClick: e => handleClick(e, i), type: "button", value: lang }, meta || `${!lang ? 'Text' : uppercase(lang)}`));
|
|
9065
9394
|
})),
|
|
9066
9395
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "CodeTabs-inner" }, children)));
|
|
9067
9396
|
};
|
|
@@ -88109,23 +88438,62 @@ const stripCommentsTransformer = () => {
|
|
|
88109
88438
|
};
|
|
88110
88439
|
};
|
|
88111
88440
|
|
|
88441
|
+
;// ./lib/utils/extractMagicBlocks.ts
|
|
88442
|
+
/**
|
|
88443
|
+
* The content matching in this regex captures everything between `[block:TYPE]`
|
|
88444
|
+
* and `[/block]`, including new lines. Negative lookahead for the closing
|
|
88445
|
+
* `[/block]` tag is required to prevent greedy matching to ensure it stops at
|
|
88446
|
+
* the first closing tag it encounters preventing vulnerability to polynomial
|
|
88447
|
+
* backtracking issues.
|
|
88448
|
+
*/
|
|
88449
|
+
const MAGIC_BLOCK_REGEX = /\[block:[^\]]{1,100}\](?:(?!\[block:)(?!\[\/block\])[\s\S])*\[\/block\]/g;
|
|
88450
|
+
/**
|
|
88451
|
+
* Extract legacy magic block syntax from a markdown string.
|
|
88452
|
+
* Returns the modified markdown and an array of extracted blocks.
|
|
88453
|
+
*/
|
|
88454
|
+
function extractMagicBlocks(markdown) {
|
|
88455
|
+
const blocks = [];
|
|
88456
|
+
let index = 0;
|
|
88457
|
+
const replaced = markdown.replace(MAGIC_BLOCK_REGEX, match => {
|
|
88458
|
+
// Use backticks so it becomes a code span, preventing remarkParse from
|
|
88459
|
+
// parsing special characters in the token as markdown syntax
|
|
88460
|
+
const token = `\`__MAGIC_BLOCK_${index}__\``;
|
|
88461
|
+
blocks.push({ token, raw: match });
|
|
88462
|
+
index += 1;
|
|
88463
|
+
return token;
|
|
88464
|
+
});
|
|
88465
|
+
return { replaced, blocks };
|
|
88466
|
+
}
|
|
88467
|
+
/**
|
|
88468
|
+
* Restore extracted magic blocks back into a markdown string.
|
|
88469
|
+
*/
|
|
88470
|
+
function restoreMagicBlocks(replaced, blocks) {
|
|
88471
|
+
return blocks.reduce((acc, { token, raw }) => {
|
|
88472
|
+
return acc.split(token).join(raw);
|
|
88473
|
+
}, replaced);
|
|
88474
|
+
}
|
|
88475
|
+
|
|
88112
88476
|
;// ./lib/stripComments.ts
|
|
88113
88477
|
|
|
88114
88478
|
|
|
88115
88479
|
|
|
88116
88480
|
|
|
88117
88481
|
|
|
88482
|
+
|
|
88118
88483
|
/**
|
|
88119
88484
|
* Removes Markdown and MDX comments.
|
|
88120
88485
|
*/
|
|
88121
88486
|
async function stripComments(doc, { mdx } = {}) {
|
|
88487
|
+
const { replaced, blocks } = extractMagicBlocks(doc);
|
|
88122
88488
|
const processor = unified()
|
|
88123
88489
|
.use(remarkParse)
|
|
88124
88490
|
.use(mdx ? remarkMdx : undefined)
|
|
88125
88491
|
.use(stripCommentsTransformer)
|
|
88126
88492
|
.use(remarkStringify);
|
|
88127
|
-
const file = await processor.process(
|
|
88128
|
-
|
|
88493
|
+
const file = await processor.process(replaced);
|
|
88494
|
+
const stringified = String(file).trim();
|
|
88495
|
+
const restored = restoreMagicBlocks(stringified, blocks);
|
|
88496
|
+
return restored;
|
|
88129
88497
|
}
|
|
88130
88498
|
/* harmony default export */ const lib_stripComments = (stripComments);
|
|
88131
88499
|
|