@readme/markdown 11.5.1 → 11.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare const utils: {
|
|
|
6
6
|
getHref: typeof getHref;
|
|
7
7
|
calloutIcons: {};
|
|
8
8
|
};
|
|
9
|
-
export { compile, exports, hast, run, mdast, mdastV6, mdx, migrate, plain, remarkPlugins, tags } from './lib';
|
|
9
|
+
export { compile, exports, hast, run, mdast, mdastV6, mdx, migrate, plain, remarkPlugins, stripComments, tags } from './lib';
|
|
10
10
|
export { default as Owlmoji } from './lib/owlmoji';
|
|
11
11
|
export { Components, utils };
|
|
12
12
|
export { tailwindCompiler } from './utils/tailwind-compiler';
|
package/dist/lib/index.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -8720,6 +8720,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
8720
8720
|
plain: () => (/* reexport */ lib_plain),
|
|
8721
8721
|
remarkPlugins: () => (/* reexport */ remarkPlugins),
|
|
8722
8722
|
run: () => (/* reexport */ lib_run),
|
|
8723
|
+
stripComments: () => (/* reexport */ lib_stripComments),
|
|
8723
8724
|
tags: () => (/* reexport */ lib_tags),
|
|
8724
8725
|
tailwindCompiler: () => (/* reexport */ tailwindCompiler),
|
|
8725
8726
|
utils: () => (/* binding */ utils)
|
|
@@ -67873,6 +67874,9 @@ const visitor = (table, index, parent) => {
|
|
|
67873
67874
|
const content = cell.children.length === 1 && cell.children[0].type === 'paragraph'
|
|
67874
67875
|
? cell.children[0].children[0]
|
|
67875
67876
|
: cell.children[0];
|
|
67877
|
+
// If cell is empty there's nothing to visit
|
|
67878
|
+
if (!content)
|
|
67879
|
+
return EXIT;
|
|
67876
67880
|
// @note: Compatibility with RDMD. Ideally, I'd put this in a separate
|
|
67877
67881
|
// transformer, but then there'd be some duplication.
|
|
67878
67882
|
visit(cell, 'break', (_, breakIndex, breakParent) => {
|
|
@@ -87979,6 +87983,66 @@ const tags = (doc) => {
|
|
|
87979
87983
|
};
|
|
87980
87984
|
/* harmony default export */ const lib_tags = (tags);
|
|
87981
87985
|
|
|
87986
|
+
;// ./processor/transform/stripComments.ts
|
|
87987
|
+
|
|
87988
|
+
const HTML_COMMENT_REGEX = /<!--[\s\S]*?-->/g;
|
|
87989
|
+
const MDX_COMMENT_REGEX = /\/\*[\s\S]*?\*\//g;
|
|
87990
|
+
/**
|
|
87991
|
+
* A remark plugin to remove comments from Markdown and MDX.
|
|
87992
|
+
*/
|
|
87993
|
+
const stripCommentsTransformer = () => {
|
|
87994
|
+
return (tree) => {
|
|
87995
|
+
visit(tree, ['html', 'mdxFlowExpression', 'mdxTextExpression'], (node, index, parent) => {
|
|
87996
|
+
if (parent && typeof index === 'number') {
|
|
87997
|
+
// Remove HTML comments
|
|
87998
|
+
if (node.type === 'html' && HTML_COMMENT_REGEX.test(node.value)) {
|
|
87999
|
+
const newValue = node.value.replace(HTML_COMMENT_REGEX, '').trim();
|
|
88000
|
+
if (newValue) {
|
|
88001
|
+
node.value = newValue;
|
|
88002
|
+
}
|
|
88003
|
+
else {
|
|
88004
|
+
parent.children.splice(index, 1);
|
|
88005
|
+
return [SKIP, index];
|
|
88006
|
+
}
|
|
88007
|
+
}
|
|
88008
|
+
// Remove MDX comments
|
|
88009
|
+
if ((node.type === 'mdxFlowExpression' || node.type === 'mdxTextExpression') &&
|
|
88010
|
+
MDX_COMMENT_REGEX.test(node.value)) {
|
|
88011
|
+
const newValue = node.value.replace(MDX_COMMENT_REGEX, '').trim();
|
|
88012
|
+
if (newValue) {
|
|
88013
|
+
node.value = newValue;
|
|
88014
|
+
}
|
|
88015
|
+
else {
|
|
88016
|
+
parent.children.splice(index, 1);
|
|
88017
|
+
return [SKIP, index];
|
|
88018
|
+
}
|
|
88019
|
+
}
|
|
88020
|
+
}
|
|
88021
|
+
return undefined;
|
|
88022
|
+
});
|
|
88023
|
+
};
|
|
88024
|
+
};
|
|
88025
|
+
|
|
88026
|
+
;// ./lib/stripComments.ts
|
|
88027
|
+
|
|
88028
|
+
|
|
88029
|
+
|
|
88030
|
+
|
|
88031
|
+
|
|
88032
|
+
/**
|
|
88033
|
+
* Removes Markdown and MDX comments.
|
|
88034
|
+
*/
|
|
88035
|
+
async function stripComments(doc, { mdx } = {}) {
|
|
88036
|
+
const processor = unified()
|
|
88037
|
+
.use(remarkParse)
|
|
88038
|
+
.use(mdx ? remarkMdx : undefined)
|
|
88039
|
+
.use(stripCommentsTransformer)
|
|
88040
|
+
.use(remarkStringify);
|
|
88041
|
+
const file = await processor.process(doc);
|
|
88042
|
+
return String(file);
|
|
88043
|
+
}
|
|
88044
|
+
/* harmony default export */ const lib_stripComments = (stripComments);
|
|
88045
|
+
|
|
87982
88046
|
;// ./lib/index.ts
|
|
87983
88047
|
|
|
87984
88048
|
|
|
@@ -87992,6 +88056,7 @@ const tags = (doc) => {
|
|
|
87992
88056
|
|
|
87993
88057
|
|
|
87994
88058
|
|
|
88059
|
+
|
|
87995
88060
|
;// ./index.tsx
|
|
87996
88061
|
|
|
87997
88062
|
|
package/dist/main.node.js
CHANGED
|
@@ -16389,6 +16389,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
16389
16389
|
plain: () => (/* reexport */ lib_plain),
|
|
16390
16390
|
remarkPlugins: () => (/* reexport */ remarkPlugins),
|
|
16391
16391
|
run: () => (/* reexport */ lib_run),
|
|
16392
|
+
stripComments: () => (/* reexport */ lib_stripComments),
|
|
16392
16393
|
tags: () => (/* reexport */ lib_tags),
|
|
16393
16394
|
tailwindCompiler: () => (/* reexport */ tailwindCompiler),
|
|
16394
16395
|
utils: () => (/* binding */ utils)
|
|
@@ -88084,6 +88085,9 @@ const visitor = (table, index, parent) => {
|
|
|
88084
88085
|
const content = cell.children.length === 1 && cell.children[0].type === 'paragraph'
|
|
88085
88086
|
? cell.children[0].children[0]
|
|
88086
88087
|
: cell.children[0];
|
|
88088
|
+
// If cell is empty there's nothing to visit
|
|
88089
|
+
if (!content)
|
|
88090
|
+
return EXIT;
|
|
88087
88091
|
// @note: Compatibility with RDMD. Ideally, I'd put this in a separate
|
|
88088
88092
|
// transformer, but then there'd be some duplication.
|
|
88089
88093
|
visit(cell, 'break', (_, breakIndex, breakParent) => {
|
|
@@ -108190,6 +108194,66 @@ const tags = (doc) => {
|
|
|
108190
108194
|
};
|
|
108191
108195
|
/* harmony default export */ const lib_tags = (tags);
|
|
108192
108196
|
|
|
108197
|
+
;// ./processor/transform/stripComments.ts
|
|
108198
|
+
|
|
108199
|
+
const HTML_COMMENT_REGEX = /<!--[\s\S]*?-->/g;
|
|
108200
|
+
const MDX_COMMENT_REGEX = /\/\*[\s\S]*?\*\//g;
|
|
108201
|
+
/**
|
|
108202
|
+
* A remark plugin to remove comments from Markdown and MDX.
|
|
108203
|
+
*/
|
|
108204
|
+
const stripCommentsTransformer = () => {
|
|
108205
|
+
return (tree) => {
|
|
108206
|
+
visit(tree, ['html', 'mdxFlowExpression', 'mdxTextExpression'], (node, index, parent) => {
|
|
108207
|
+
if (parent && typeof index === 'number') {
|
|
108208
|
+
// Remove HTML comments
|
|
108209
|
+
if (node.type === 'html' && HTML_COMMENT_REGEX.test(node.value)) {
|
|
108210
|
+
const newValue = node.value.replace(HTML_COMMENT_REGEX, '').trim();
|
|
108211
|
+
if (newValue) {
|
|
108212
|
+
node.value = newValue;
|
|
108213
|
+
}
|
|
108214
|
+
else {
|
|
108215
|
+
parent.children.splice(index, 1);
|
|
108216
|
+
return [SKIP, index];
|
|
108217
|
+
}
|
|
108218
|
+
}
|
|
108219
|
+
// Remove MDX comments
|
|
108220
|
+
if ((node.type === 'mdxFlowExpression' || node.type === 'mdxTextExpression') &&
|
|
108221
|
+
MDX_COMMENT_REGEX.test(node.value)) {
|
|
108222
|
+
const newValue = node.value.replace(MDX_COMMENT_REGEX, '').trim();
|
|
108223
|
+
if (newValue) {
|
|
108224
|
+
node.value = newValue;
|
|
108225
|
+
}
|
|
108226
|
+
else {
|
|
108227
|
+
parent.children.splice(index, 1);
|
|
108228
|
+
return [SKIP, index];
|
|
108229
|
+
}
|
|
108230
|
+
}
|
|
108231
|
+
}
|
|
108232
|
+
return undefined;
|
|
108233
|
+
});
|
|
108234
|
+
};
|
|
108235
|
+
};
|
|
108236
|
+
|
|
108237
|
+
;// ./lib/stripComments.ts
|
|
108238
|
+
|
|
108239
|
+
|
|
108240
|
+
|
|
108241
|
+
|
|
108242
|
+
|
|
108243
|
+
/**
|
|
108244
|
+
* Removes Markdown and MDX comments.
|
|
108245
|
+
*/
|
|
108246
|
+
async function stripComments(doc, { mdx } = {}) {
|
|
108247
|
+
const processor = unified()
|
|
108248
|
+
.use(remarkParse)
|
|
108249
|
+
.use(mdx ? remarkMdx : undefined)
|
|
108250
|
+
.use(stripCommentsTransformer)
|
|
108251
|
+
.use(remarkStringify);
|
|
108252
|
+
const file = await processor.process(doc);
|
|
108253
|
+
return String(file);
|
|
108254
|
+
}
|
|
108255
|
+
/* harmony default export */ const lib_stripComments = (stripComments);
|
|
108256
|
+
|
|
108193
108257
|
;// ./lib/index.ts
|
|
108194
108258
|
|
|
108195
108259
|
|
|
@@ -108203,6 +108267,7 @@ const tags = (doc) => {
|
|
|
108203
108267
|
|
|
108204
108268
|
|
|
108205
108269
|
|
|
108270
|
+
|
|
108206
108271
|
;// ./index.tsx
|
|
108207
108272
|
|
|
108208
108273
|
|