@readme/markdown 11.7.3 → 11.7.5
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.js
CHANGED
|
@@ -88092,6 +88092,21 @@ const migrateCallouts = () => (tree) => {
|
|
|
88092
88092
|
};
|
|
88093
88093
|
/* harmony default export */ const migrate_callouts = (migrateCallouts);
|
|
88094
88094
|
|
|
88095
|
+
;// ./processor/transform/migrate-html-blocks.ts
|
|
88096
|
+
|
|
88097
|
+
const MigrateHtmlBlocks = () => tree => {
|
|
88098
|
+
visit(tree, 'html-block', (node) => {
|
|
88099
|
+
const { html, runScripts } = node.data?.hProperties || {};
|
|
88100
|
+
const escaped = html.replaceAll(/\\/g, '\\\\');
|
|
88101
|
+
node.data.hProperties = {
|
|
88102
|
+
...(runScripts && { runScripts }),
|
|
88103
|
+
html: escaped,
|
|
88104
|
+
};
|
|
88105
|
+
});
|
|
88106
|
+
return tree;
|
|
88107
|
+
};
|
|
88108
|
+
/* harmony default export */ const migrate_html_blocks = (MigrateHtmlBlocks);
|
|
88109
|
+
|
|
88095
88110
|
;// ./processor/transform/migrate-html-tags.ts
|
|
88096
88111
|
|
|
88097
88112
|
// Add more visits to migrate other HTML tags here
|
|
@@ -88157,14 +88172,18 @@ const migrateComments = (doc, migrateDoc, opts) => {
|
|
|
88157
88172
|
|
|
88158
88173
|
|
|
88159
88174
|
|
|
88175
|
+
|
|
88160
88176
|
const migrateDoc = (doc, { rdmd }) => {
|
|
88161
88177
|
const ast = lib_mdastV6(doc, { rdmd });
|
|
88162
|
-
return lib_mdx(ast, {
|
|
88178
|
+
return (lib_mdx(ast, {
|
|
88179
|
+
remarkTransformers: [migrate_callouts, [migrate_link_references, { rdmd }], migrate_html_tags, migrate_html_blocks],
|
|
88180
|
+
file: doc,
|
|
88181
|
+
})
|
|
88163
88182
|
.replaceAll(/ /g, ' ')
|
|
88164
88183
|
// @note: I'm not sure what's happening, but I think mdx is converting an
|
|
88165
88184
|
// 'a' to 'a' as a means of escaping it. I think this helps with
|
|
88166
88185
|
// parsing weird cases.
|
|
88167
|
-
.replaceAll(/a/g, 'a');
|
|
88186
|
+
.replaceAll(/a/g, 'a'));
|
|
88168
88187
|
};
|
|
88169
88188
|
const migrate = (doc, opts) => {
|
|
88170
88189
|
const migratedDoc = migrateDoc(doc, opts);
|
|
@@ -88443,6 +88462,7 @@ function restoreMagicBlocks(replaced, blocks) {
|
|
|
88443
88462
|
|
|
88444
88463
|
|
|
88445
88464
|
|
|
88465
|
+
|
|
88446
88466
|
/**
|
|
88447
88467
|
* Removes Markdown and MDX comments.
|
|
88448
88468
|
*/
|
|
@@ -88452,7 +88472,20 @@ async function stripComments(doc, { mdx } = {}) {
|
|
|
88452
88472
|
.use(remarkParse)
|
|
88453
88473
|
.use(mdx ? remarkMdx : undefined)
|
|
88454
88474
|
.use(stripCommentsTransformer)
|
|
88455
|
-
.use(remarkStringify
|
|
88475
|
+
.use(remarkStringify, mdx
|
|
88476
|
+
? {}
|
|
88477
|
+
: {
|
|
88478
|
+
handlers: {
|
|
88479
|
+
// Preserve <<...>> variables without escaping any angle brackets.
|
|
88480
|
+
text(node, _, state, info) {
|
|
88481
|
+
// If text contains <<...>> pattern, return as is.
|
|
88482
|
+
if (new RegExp(variable_.VARIABLE_REGEXP).test(node.value))
|
|
88483
|
+
return node.value;
|
|
88484
|
+
// Otherwise, handle each text node normally.
|
|
88485
|
+
return state.safe(node.value, info);
|
|
88486
|
+
},
|
|
88487
|
+
},
|
|
88488
|
+
});
|
|
88456
88489
|
const file = await processor.process(replaced);
|
|
88457
88490
|
const stringified = String(file).trim();
|
|
88458
88491
|
const restored = restoreMagicBlocks(stringified, blocks);
|
package/dist/main.node.js
CHANGED
|
@@ -108296,6 +108296,21 @@ const migrateCallouts = () => (tree) => {
|
|
|
108296
108296
|
};
|
|
108297
108297
|
/* harmony default export */ const migrate_callouts = (migrateCallouts);
|
|
108298
108298
|
|
|
108299
|
+
;// ./processor/transform/migrate-html-blocks.ts
|
|
108300
|
+
|
|
108301
|
+
const MigrateHtmlBlocks = () => tree => {
|
|
108302
|
+
visit(tree, 'html-block', (node) => {
|
|
108303
|
+
const { html, runScripts } = node.data?.hProperties || {};
|
|
108304
|
+
const escaped = html.replaceAll(/\\/g, '\\\\');
|
|
108305
|
+
node.data.hProperties = {
|
|
108306
|
+
...(runScripts && { runScripts }),
|
|
108307
|
+
html: escaped,
|
|
108308
|
+
};
|
|
108309
|
+
});
|
|
108310
|
+
return tree;
|
|
108311
|
+
};
|
|
108312
|
+
/* harmony default export */ const migrate_html_blocks = (MigrateHtmlBlocks);
|
|
108313
|
+
|
|
108299
108314
|
;// ./processor/transform/migrate-html-tags.ts
|
|
108300
108315
|
|
|
108301
108316
|
// Add more visits to migrate other HTML tags here
|
|
@@ -108361,14 +108376,18 @@ const migrateComments = (doc, migrateDoc, opts) => {
|
|
|
108361
108376
|
|
|
108362
108377
|
|
|
108363
108378
|
|
|
108379
|
+
|
|
108364
108380
|
const migrateDoc = (doc, { rdmd }) => {
|
|
108365
108381
|
const ast = lib_mdastV6(doc, { rdmd });
|
|
108366
|
-
return lib_mdx(ast, {
|
|
108382
|
+
return (lib_mdx(ast, {
|
|
108383
|
+
remarkTransformers: [migrate_callouts, [migrate_link_references, { rdmd }], migrate_html_tags, migrate_html_blocks],
|
|
108384
|
+
file: doc,
|
|
108385
|
+
})
|
|
108367
108386
|
.replaceAll(/ /g, ' ')
|
|
108368
108387
|
// @note: I'm not sure what's happening, but I think mdx is converting an
|
|
108369
108388
|
// 'a' to 'a' as a means of escaping it. I think this helps with
|
|
108370
108389
|
// parsing weird cases.
|
|
108371
|
-
.replaceAll(/a/g, 'a');
|
|
108390
|
+
.replaceAll(/a/g, 'a'));
|
|
108372
108391
|
};
|
|
108373
108392
|
const migrate = (doc, opts) => {
|
|
108374
108393
|
const migratedDoc = migrateDoc(doc, opts);
|
|
@@ -108647,6 +108666,7 @@ function restoreMagicBlocks(replaced, blocks) {
|
|
|
108647
108666
|
|
|
108648
108667
|
|
|
108649
108668
|
|
|
108669
|
+
|
|
108650
108670
|
/**
|
|
108651
108671
|
* Removes Markdown and MDX comments.
|
|
108652
108672
|
*/
|
|
@@ -108656,7 +108676,20 @@ async function stripComments(doc, { mdx } = {}) {
|
|
|
108656
108676
|
.use(remarkParse)
|
|
108657
108677
|
.use(mdx ? remarkMdx : undefined)
|
|
108658
108678
|
.use(stripCommentsTransformer)
|
|
108659
|
-
.use(remarkStringify
|
|
108679
|
+
.use(remarkStringify, mdx
|
|
108680
|
+
? {}
|
|
108681
|
+
: {
|
|
108682
|
+
handlers: {
|
|
108683
|
+
// Preserve <<...>> variables without escaping any angle brackets.
|
|
108684
|
+
text(node, _, state, info) {
|
|
108685
|
+
// If text contains <<...>> pattern, return as is.
|
|
108686
|
+
if (new RegExp(dist.VARIABLE_REGEXP).test(node.value))
|
|
108687
|
+
return node.value;
|
|
108688
|
+
// Otherwise, handle each text node normally.
|
|
108689
|
+
return state.safe(node.value, info);
|
|
108690
|
+
},
|
|
108691
|
+
},
|
|
108692
|
+
});
|
|
108660
108693
|
const file = await processor.process(replaced);
|
|
108661
108694
|
const stringified = String(file).trim();
|
|
108662
108695
|
const restored = restoreMagicBlocks(stringified, blocks);
|