@readme/markdown 14.13.2 → 14.14.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 +1 -1
- package/dist/lib/htmlToMarkdown.d.ts +5 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/main.js +289 -237
- package/dist/main.node.js +289 -237
- package/dist/main.node.js.map +1 -1
- package/dist/processor/utils.d.ts +11 -0
- package/dist/render-fixture.node.js +288 -237
- package/dist/render-fixture.node.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,17 @@ import { Parser } from 'acorn';
|
|
|
9
9
|
* to parse expressions containing JSX.
|
|
10
10
|
*/
|
|
11
11
|
export declare const jsxAcornParser: typeof Parser;
|
|
12
|
+
/**
|
|
13
|
+
* Disables CommonMark's indented-code-block construct (4+ spaces)
|
|
14
|
+
* The micromark tokenizers use follow the CommonMark specification: https://spec.commonmark.org/0.28/#indented-code-blocks
|
|
15
|
+
* So any lines indented 4+ spaces are considered as a code block,
|
|
16
|
+
* which is unexpected from users that used MDX before.
|
|
17
|
+
*/
|
|
18
|
+
export declare const disableIndentedCode: {
|
|
19
|
+
disable: {
|
|
20
|
+
null: string[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
12
23
|
/**
|
|
13
24
|
* Evaluate a JavaScript expression source and return its value.
|
|
14
25
|
*
|
|
@@ -68469,6 +68469,13 @@ const mdast_mdast = (text, opts = {}) => {
|
|
|
68469
68469
|
* to parse expressions containing JSX.
|
|
68470
68470
|
*/
|
|
68471
68471
|
const jsxAcornParser = Parser.extend(acorn_jsx_default()());
|
|
68472
|
+
/**
|
|
68473
|
+
* Disables CommonMark's indented-code-block construct (4+ spaces)
|
|
68474
|
+
* The micromark tokenizers use follow the CommonMark specification: https://spec.commonmark.org/0.28/#indented-code-blocks
|
|
68475
|
+
* So any lines indented 4+ spaces are considered as a code block,
|
|
68476
|
+
* which is unexpected from users that used MDX before.
|
|
68477
|
+
*/
|
|
68478
|
+
const disableIndentedCode = { disable: { null: ['codeIndented'] } };
|
|
68472
68479
|
/**
|
|
68473
68480
|
* Evaluate a JavaScript expression source and return its value.
|
|
68474
68481
|
*
|
|
@@ -112669,185 +112676,70 @@ const hast = (text, opts = {}) => {
|
|
|
112669
112676
|
};
|
|
112670
112677
|
/* harmony default export */ const lib_hast = ((/* unused pure expression or super */ null && (hast)));
|
|
112671
112678
|
|
|
112672
|
-
;// ./
|
|
112673
|
-
|
|
112674
|
-
|
|
112675
|
-
|
|
112676
|
-
|
|
112677
|
-
|
|
112678
|
-
const prev = parent.children[index - 1];
|
|
112679
|
-
if (!('value' in prev) || prev.value.endsWith(' ') || prev.type === 'escape')
|
|
112680
|
-
return;
|
|
112681
|
-
parent.children.splice(index, 0, { type: 'text', value: ' ' });
|
|
112682
|
-
};
|
|
112683
|
-
const addSpaceAfter = (index, parent) => {
|
|
112684
|
-
if (!(index < parent.children.length - 1 && parent.children[index + 1]))
|
|
112685
|
-
return;
|
|
112686
|
-
const nextChild = parent.children[index + 1];
|
|
112687
|
-
if (!('value' in nextChild) || nextChild.value.startsWith(' '))
|
|
112688
|
-
return;
|
|
112689
|
-
parent.children.splice(index + 1, 0, { type: 'text', value: ' ' });
|
|
112690
|
-
};
|
|
112691
|
-
const trimEmphasis = (node, index, parent) => {
|
|
112692
|
-
let trimmed = false;
|
|
112693
|
-
lib_visit(node, 'text', (child) => {
|
|
112694
|
-
const newValue = child.value.trimStart();
|
|
112695
|
-
if (newValue !== child.value) {
|
|
112696
|
-
trimmed = true;
|
|
112697
|
-
child.value = newValue;
|
|
112698
|
-
}
|
|
112699
|
-
return EXIT;
|
|
112700
|
-
});
|
|
112701
|
-
lib_visit(node, 'text', (child) => {
|
|
112702
|
-
const newValue = child.value.trimEnd();
|
|
112703
|
-
if (newValue !== child.value) {
|
|
112704
|
-
trimmed = true;
|
|
112705
|
-
child.value = newValue;
|
|
112706
|
-
}
|
|
112707
|
-
return EXIT;
|
|
112708
|
-
}, true);
|
|
112709
|
-
if (trimmed) {
|
|
112710
|
-
addSpaceBefore(index, parent);
|
|
112711
|
-
addSpaceAfter(index, parent);
|
|
112712
|
-
}
|
|
112713
|
-
};
|
|
112714
|
-
const emphasisTransfomer = () => (tree) => {
|
|
112715
|
-
lib_visit(tree, emphasis_strongTest, trimEmphasis);
|
|
112716
|
-
return tree;
|
|
112717
|
-
};
|
|
112718
|
-
/* harmony default export */ const migration_emphasis = (emphasisTransfomer);
|
|
112679
|
+
;// ./node_modules/rehype-parse/lib/index.js
|
|
112680
|
+
/**
|
|
112681
|
+
* @import {Root} from 'hast'
|
|
112682
|
+
* @import {Options as FromHtmlOptions} from 'hast-util-from-html'
|
|
112683
|
+
* @import {Parser, Processor} from 'unified'
|
|
112684
|
+
*/
|
|
112719
112685
|
|
|
112720
|
-
|
|
112686
|
+
/**
|
|
112687
|
+
* @typedef {Omit<FromHtmlOptions, 'onerror'> & RehypeParseFields} Options
|
|
112688
|
+
* Configuration.
|
|
112689
|
+
*
|
|
112690
|
+
* @typedef RehypeParseFields
|
|
112691
|
+
* Extra fields.
|
|
112692
|
+
* @property {boolean | null | undefined} [emitParseErrors=false]
|
|
112693
|
+
* Whether to emit parse errors while parsing (default: `false`).
|
|
112694
|
+
*
|
|
112695
|
+
* > 👉 **Note**: parse errors are currently being added to HTML.
|
|
112696
|
+
* > Not all errors emitted by parse5 (or us) are specced yet.
|
|
112697
|
+
* > Some documentation may still be missing.
|
|
112698
|
+
*/
|
|
112721
112699
|
|
|
112722
|
-
const images_imageTransformer = () => tree => {
|
|
112723
|
-
lib_visit(tree, 'image', (image) => {
|
|
112724
|
-
if (image.data?.hProperties?.className === 'border') {
|
|
112725
|
-
image.data.hProperties.border = true;
|
|
112726
|
-
}
|
|
112727
|
-
});
|
|
112728
|
-
};
|
|
112729
|
-
/* harmony default export */ const migration_images = (images_imageTransformer);
|
|
112730
112700
|
|
|
112731
|
-
;// ./processor/migration/linkReference.ts
|
|
112732
112701
|
|
|
112733
|
-
|
|
112734
|
-
|
|
112735
|
-
|
|
112736
|
-
|
|
112737
|
-
|
|
112738
|
-
|
|
112739
|
-
|
|
112740
|
-
|
|
112741
|
-
|
|
112742
|
-
|
|
112743
|
-
|
|
112744
|
-
|
|
112745
|
-
|
|
112746
|
-
|
|
112747
|
-
|
|
112748
|
-
|
|
112749
|
-
|
|
112750
|
-
|
|
112751
|
-
|
|
112702
|
+
/**
|
|
112703
|
+
* Plugin to add support for parsing from HTML.
|
|
112704
|
+
*
|
|
112705
|
+
* > 👉 **Note**: this is not an XML parser.
|
|
112706
|
+
* > It supports SVG as embedded in HTML.
|
|
112707
|
+
* > It does not support the features available in XML.
|
|
112708
|
+
* > Passing SVG files might break but fragments of modern SVG should be fine.
|
|
112709
|
+
* > Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.
|
|
112710
|
+
*
|
|
112711
|
+
* @param {Options | null | undefined} [options]
|
|
112712
|
+
* Configuration (optional).
|
|
112713
|
+
* @returns {undefined}
|
|
112714
|
+
* Nothing.
|
|
112715
|
+
*/
|
|
112716
|
+
function rehypeParse(options) {
|
|
112717
|
+
/** @type {Processor<Root>} */
|
|
112718
|
+
// @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.
|
|
112719
|
+
const self = this
|
|
112720
|
+
const {emitParseErrors, ...settings} = {...self.data('settings'), ...options}
|
|
112752
112721
|
|
|
112753
|
-
|
|
112722
|
+
self.parser = parser
|
|
112754
112723
|
|
|
112755
|
-
|
|
112756
|
-
|
|
112757
|
-
|
|
112758
|
-
|
|
112759
|
-
|
|
112760
|
-
|
|
112761
|
-
|
|
112762
|
-
|
|
112763
|
-
|
|
112764
|
-
|
|
112765
|
-
|
|
112766
|
-
// This is a perfectly valid list. But when you put that text into a table
|
|
112767
|
-
// cell, the editor does **bad** things. After a save and load cycle, it gets
|
|
112768
|
-
// converted to this:
|
|
112769
|
-
//
|
|
112770
|
-
// ```
|
|
112771
|
-
// \_ item 1
|
|
112772
|
-
// \_ item 2
|
|
112773
|
-
// \* item 3
|
|
112774
|
-
// ```
|
|
112775
|
-
//
|
|
112776
|
-
// The following regex attempts to detect this pattern, and we'll convert it to
|
|
112777
|
-
// something more standard.
|
|
112778
|
-
const psuedoListRegex = /^(?![ \t]*([*_]+).*\1[ \t]*$)(?<ws>[ \t]*)\\?([*_])\s*(?<item>.*)$/gm;
|
|
112779
|
-
const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
112780
|
-
let json;
|
|
112781
|
-
try {
|
|
112782
|
-
const { position } = table;
|
|
112783
|
-
if (position) {
|
|
112784
|
-
json = JSON.parse(vfile
|
|
112785
|
-
.toString()
|
|
112786
|
-
.slice(position.start.offset, position.end.offset)
|
|
112787
|
-
.replace(/.*\[block:parameters\](.*)\[\/block\].*/s, '$1'));
|
|
112788
|
-
}
|
|
112789
|
-
}
|
|
112790
|
-
catch (err) {
|
|
112791
|
-
/**
|
|
112792
|
-
* This failure case is already handled by the following logic. Plus,
|
|
112793
|
-
* because it's being handled internally, there's no way for our
|
|
112794
|
-
* migration script to catch the error or keep track of it, and it just
|
|
112795
|
-
* ends up blowing up the output logs.
|
|
112796
|
-
*/
|
|
112797
|
-
// console.error(err);
|
|
112798
|
-
}
|
|
112799
|
-
lib_visit(table, 'tableRow', (row, i) => {
|
|
112800
|
-
lib_visit(row, 'tableCell', (cell, j) => {
|
|
112801
|
-
let children = cell.children;
|
|
112802
|
-
if (json && json.data[magicIndex(i, j)]) {
|
|
112803
|
-
const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
|
|
112804
|
-
children = rdmd.mdast(string).children;
|
|
112724
|
+
/**
|
|
112725
|
+
* @type {Parser<Root>}
|
|
112726
|
+
*/
|
|
112727
|
+
function parser(document, file) {
|
|
112728
|
+
return fromHtml(document, {
|
|
112729
|
+
...settings,
|
|
112730
|
+
onerror: emitParseErrors
|
|
112731
|
+
? function (message) {
|
|
112732
|
+
if (file.path) {
|
|
112733
|
+
message.name = file.path + ':' + message.name
|
|
112734
|
+
message.file = file.path
|
|
112805
112735
|
}
|
|
112806
|
-
cell.children =
|
|
112807
|
-
children.length > 1 && !children.some(isInlineHtml)
|
|
112808
|
-
? children
|
|
112809
|
-
: [{ type: 'paragraph', children }];
|
|
112810
|
-
return lib_SKIP;
|
|
112811
|
-
});
|
|
112812
|
-
return lib_SKIP;
|
|
112813
|
-
});
|
|
112814
|
-
lib_visit(table, 'inlineCode', (code) => {
|
|
112815
|
-
if (code.value.includes('\n')) {
|
|
112816
|
-
code.type = 'code';
|
|
112817
|
-
}
|
|
112818
|
-
});
|
|
112819
|
-
};
|
|
112820
|
-
function tableCellTransformer() {
|
|
112821
|
-
const rdmd = this.data('rdmd');
|
|
112822
|
-
return (tree, vfile) => {
|
|
112823
|
-
lib_visit(tree, 'table', migrateTableCells(vfile, rdmd));
|
|
112824
|
-
return tree;
|
|
112825
|
-
};
|
|
112826
|
-
}
|
|
112827
|
-
/* harmony default export */ const table_cell = (tableCellTransformer);
|
|
112828
112736
|
|
|
112829
|
-
|
|
112830
|
-
|
|
112831
|
-
|
|
112832
|
-
|
|
112833
|
-
|
|
112834
|
-
|
|
112835
|
-
/* harmony default export */ const migration = ((/* unused pure expression or super */ null && (transformers)));
|
|
112836
|
-
|
|
112837
|
-
;// ./lib/mdastV6.ts
|
|
112838
|
-
|
|
112839
|
-
const migrationNormalize = (doc) => {
|
|
112840
|
-
return doc.replaceAll(/^(<!--.*?)\\-->$/gms, '$1-->');
|
|
112841
|
-
};
|
|
112842
|
-
const mdastV6_mdastV6 = (doc, { rdmd }) => {
|
|
112843
|
-
const [_normalizedDoc] = rdmd.setup(doc);
|
|
112844
|
-
const normalizedDoc = migrationNormalize(_normalizedDoc);
|
|
112845
|
-
const proc = rdmd.processor().use(migrationTransformers).data('rdmd', rdmd);
|
|
112846
|
-
const tree = proc.parse(normalizedDoc);
|
|
112847
|
-
proc.runSync(tree, normalizedDoc);
|
|
112848
|
-
return tree;
|
|
112849
|
-
};
|
|
112850
|
-
/* harmony default export */ const lib_mdastV6 = ((/* unused pure expression or super */ null && (mdastV6_mdastV6)));
|
|
112737
|
+
file.messages.push(message)
|
|
112738
|
+
}
|
|
112739
|
+
: undefined
|
|
112740
|
+
})
|
|
112741
|
+
}
|
|
112742
|
+
}
|
|
112851
112743
|
|
|
112852
112744
|
;// ./node_modules/hast-util-is-element/lib/index.js
|
|
112853
112745
|
/**
|
|
@@ -117374,6 +117266,227 @@ function rehypeRemark(destination, options) {
|
|
|
117374
117266
|
}
|
|
117375
117267
|
}
|
|
117376
117268
|
|
|
117269
|
+
;// ./lib/htmlToMarkdown.ts
|
|
117270
|
+
|
|
117271
|
+
|
|
117272
|
+
|
|
117273
|
+
|
|
117274
|
+
|
|
117275
|
+
/**
|
|
117276
|
+
* Converts an HTML fragment to GitHub-flavored Markdown.
|
|
117277
|
+
*
|
|
117278
|
+
* `remark-gfm` is load-bearing: without it, `<table>` and `<del>` input throws
|
|
117279
|
+
* at serialization. `iframe` (default: becomes a link) and `noscript` (default:
|
|
117280
|
+
* keeps its text) are dropped by the handlers so raw markup never leaks;
|
|
117281
|
+
* `script`, `style`, and `template` already drop by default and are overridden
|
|
117282
|
+
* defensively. HTML comments are dropped via `nodeHandlers`.
|
|
117283
|
+
*/
|
|
117284
|
+
const processor = lib_unified()
|
|
117285
|
+
.use(rehypeParse, { fragment: true })
|
|
117286
|
+
.use(rehypeRemark, {
|
|
117287
|
+
// A comment is a `comment` node, not an element, so it goes in
|
|
117288
|
+
// `nodeHandlers` rather than `handlers`.
|
|
117289
|
+
handlers: {
|
|
117290
|
+
iframe: () => undefined,
|
|
117291
|
+
noscript: () => undefined,
|
|
117292
|
+
script: () => undefined,
|
|
117293
|
+
style: () => undefined,
|
|
117294
|
+
template: () => undefined,
|
|
117295
|
+
},
|
|
117296
|
+
nodeHandlers: { comment: () => undefined },
|
|
117297
|
+
})
|
|
117298
|
+
.use(lib_remarkGfm)
|
|
117299
|
+
.use(lib_remarkStringify, { bullet: '-', emphasis: '_', fences: true });
|
|
117300
|
+
/**
|
|
117301
|
+
* Returns the Markdown form of `html`, or an empty string when there is no
|
|
117302
|
+
* usable input. Synchronous, so it can run inside non-async serializers.
|
|
117303
|
+
*/
|
|
117304
|
+
function htmlToMarkdown(html) {
|
|
117305
|
+
if (typeof html !== 'string' || !html.trim())
|
|
117306
|
+
return '';
|
|
117307
|
+
return processor.processSync(html).toString().trim();
|
|
117308
|
+
}
|
|
117309
|
+
|
|
117310
|
+
;// ./processor/migration/emphasis.ts
|
|
117311
|
+
|
|
117312
|
+
const emphasis_strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
|
|
117313
|
+
const addSpaceBefore = (index, parent) => {
|
|
117314
|
+
if (!(index > 0 && parent.children[index - 1]))
|
|
117315
|
+
return;
|
|
117316
|
+
const prev = parent.children[index - 1];
|
|
117317
|
+
if (!('value' in prev) || prev.value.endsWith(' ') || prev.type === 'escape')
|
|
117318
|
+
return;
|
|
117319
|
+
parent.children.splice(index, 0, { type: 'text', value: ' ' });
|
|
117320
|
+
};
|
|
117321
|
+
const addSpaceAfter = (index, parent) => {
|
|
117322
|
+
if (!(index < parent.children.length - 1 && parent.children[index + 1]))
|
|
117323
|
+
return;
|
|
117324
|
+
const nextChild = parent.children[index + 1];
|
|
117325
|
+
if (!('value' in nextChild) || nextChild.value.startsWith(' '))
|
|
117326
|
+
return;
|
|
117327
|
+
parent.children.splice(index + 1, 0, { type: 'text', value: ' ' });
|
|
117328
|
+
};
|
|
117329
|
+
const trimEmphasis = (node, index, parent) => {
|
|
117330
|
+
let trimmed = false;
|
|
117331
|
+
lib_visit(node, 'text', (child) => {
|
|
117332
|
+
const newValue = child.value.trimStart();
|
|
117333
|
+
if (newValue !== child.value) {
|
|
117334
|
+
trimmed = true;
|
|
117335
|
+
child.value = newValue;
|
|
117336
|
+
}
|
|
117337
|
+
return EXIT;
|
|
117338
|
+
});
|
|
117339
|
+
lib_visit(node, 'text', (child) => {
|
|
117340
|
+
const newValue = child.value.trimEnd();
|
|
117341
|
+
if (newValue !== child.value) {
|
|
117342
|
+
trimmed = true;
|
|
117343
|
+
child.value = newValue;
|
|
117344
|
+
}
|
|
117345
|
+
return EXIT;
|
|
117346
|
+
}, true);
|
|
117347
|
+
if (trimmed) {
|
|
117348
|
+
addSpaceBefore(index, parent);
|
|
117349
|
+
addSpaceAfter(index, parent);
|
|
117350
|
+
}
|
|
117351
|
+
};
|
|
117352
|
+
const emphasisTransfomer = () => (tree) => {
|
|
117353
|
+
lib_visit(tree, emphasis_strongTest, trimEmphasis);
|
|
117354
|
+
return tree;
|
|
117355
|
+
};
|
|
117356
|
+
/* harmony default export */ const migration_emphasis = (emphasisTransfomer);
|
|
117357
|
+
|
|
117358
|
+
;// ./processor/migration/images.ts
|
|
117359
|
+
|
|
117360
|
+
const images_imageTransformer = () => tree => {
|
|
117361
|
+
lib_visit(tree, 'image', (image) => {
|
|
117362
|
+
if (image.data?.hProperties?.className === 'border') {
|
|
117363
|
+
image.data.hProperties.border = true;
|
|
117364
|
+
}
|
|
117365
|
+
});
|
|
117366
|
+
};
|
|
117367
|
+
/* harmony default export */ const migration_images = (images_imageTransformer);
|
|
117368
|
+
|
|
117369
|
+
;// ./processor/migration/linkReference.ts
|
|
117370
|
+
|
|
117371
|
+
const linkReferenceTransformer = () => (tree) => {
|
|
117372
|
+
lib_visit(tree, 'linkReference', (node, index, parent) => {
|
|
117373
|
+
const definitions = {};
|
|
117374
|
+
lib_visit(tree, 'definition', (def) => {
|
|
117375
|
+
definitions[def.identifier] = def;
|
|
117376
|
+
});
|
|
117377
|
+
if (node.label === node.identifier && parent) {
|
|
117378
|
+
if (!(node.identifier in definitions)) {
|
|
117379
|
+
parent.children[index] = {
|
|
117380
|
+
type: 'text',
|
|
117381
|
+
value: `[${node.label}]`,
|
|
117382
|
+
position: node.position,
|
|
117383
|
+
};
|
|
117384
|
+
}
|
|
117385
|
+
}
|
|
117386
|
+
});
|
|
117387
|
+
return tree;
|
|
117388
|
+
};
|
|
117389
|
+
/* harmony default export */ const migration_linkReference = (linkReferenceTransformer);
|
|
117390
|
+
|
|
117391
|
+
;// ./processor/migration/table-cell.ts
|
|
117392
|
+
|
|
117393
|
+
const magicIndex = (i, j) => `${i === 0 ? 'h' : `${i - 1}`}-${j}`;
|
|
117394
|
+
const isInlineHtml = node => node.type === 'html' && !node.block;
|
|
117395
|
+
// @note: This regex is detect malformed lists that were created by the
|
|
117396
|
+
// markdown editor. Consider the following markdown:
|
|
117397
|
+
//
|
|
117398
|
+
// ```
|
|
117399
|
+
// * item 1
|
|
117400
|
+
// * item 2
|
|
117401
|
+
// * item 3
|
|
117402
|
+
// ```
|
|
117403
|
+
//
|
|
117404
|
+
// This is a perfectly valid list. But when you put that text into a table
|
|
117405
|
+
// cell, the editor does **bad** things. After a save and load cycle, it gets
|
|
117406
|
+
// converted to this:
|
|
117407
|
+
//
|
|
117408
|
+
// ```
|
|
117409
|
+
// \_ item 1
|
|
117410
|
+
// \_ item 2
|
|
117411
|
+
// \* item 3
|
|
117412
|
+
// ```
|
|
117413
|
+
//
|
|
117414
|
+
// The following regex attempts to detect this pattern, and we'll convert it to
|
|
117415
|
+
// something more standard.
|
|
117416
|
+
const psuedoListRegex = /^(?![ \t]*([*_]+).*\1[ \t]*$)(?<ws>[ \t]*)\\?([*_])\s*(?<item>.*)$/gm;
|
|
117417
|
+
const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
117418
|
+
let json;
|
|
117419
|
+
try {
|
|
117420
|
+
const { position } = table;
|
|
117421
|
+
if (position) {
|
|
117422
|
+
json = JSON.parse(vfile
|
|
117423
|
+
.toString()
|
|
117424
|
+
.slice(position.start.offset, position.end.offset)
|
|
117425
|
+
.replace(/.*\[block:parameters\](.*)\[\/block\].*/s, '$1'));
|
|
117426
|
+
}
|
|
117427
|
+
}
|
|
117428
|
+
catch (err) {
|
|
117429
|
+
/**
|
|
117430
|
+
* This failure case is already handled by the following logic. Plus,
|
|
117431
|
+
* because it's being handled internally, there's no way for our
|
|
117432
|
+
* migration script to catch the error or keep track of it, and it just
|
|
117433
|
+
* ends up blowing up the output logs.
|
|
117434
|
+
*/
|
|
117435
|
+
// console.error(err);
|
|
117436
|
+
}
|
|
117437
|
+
lib_visit(table, 'tableRow', (row, i) => {
|
|
117438
|
+
lib_visit(row, 'tableCell', (cell, j) => {
|
|
117439
|
+
let children = cell.children;
|
|
117440
|
+
if (json && json.data[magicIndex(i, j)]) {
|
|
117441
|
+
const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
|
|
117442
|
+
children = rdmd.mdast(string).children;
|
|
117443
|
+
}
|
|
117444
|
+
cell.children =
|
|
117445
|
+
children.length > 1 && !children.some(isInlineHtml)
|
|
117446
|
+
? children
|
|
117447
|
+
: [{ type: 'paragraph', children }];
|
|
117448
|
+
return lib_SKIP;
|
|
117449
|
+
});
|
|
117450
|
+
return lib_SKIP;
|
|
117451
|
+
});
|
|
117452
|
+
lib_visit(table, 'inlineCode', (code) => {
|
|
117453
|
+
if (code.value.includes('\n')) {
|
|
117454
|
+
code.type = 'code';
|
|
117455
|
+
}
|
|
117456
|
+
});
|
|
117457
|
+
};
|
|
117458
|
+
function tableCellTransformer() {
|
|
117459
|
+
const rdmd = this.data('rdmd');
|
|
117460
|
+
return (tree, vfile) => {
|
|
117461
|
+
lib_visit(tree, 'table', migrateTableCells(vfile, rdmd));
|
|
117462
|
+
return tree;
|
|
117463
|
+
};
|
|
117464
|
+
}
|
|
117465
|
+
/* harmony default export */ const table_cell = (tableCellTransformer);
|
|
117466
|
+
|
|
117467
|
+
;// ./processor/migration/index.ts
|
|
117468
|
+
|
|
117469
|
+
|
|
117470
|
+
|
|
117471
|
+
|
|
117472
|
+
const transformers = [migration_emphasis, migration_images, migration_linkReference, table_cell];
|
|
117473
|
+
/* harmony default export */ const migration = ((/* unused pure expression or super */ null && (transformers)));
|
|
117474
|
+
|
|
117475
|
+
;// ./lib/mdastV6.ts
|
|
117476
|
+
|
|
117477
|
+
const migrationNormalize = (doc) => {
|
|
117478
|
+
return doc.replaceAll(/^(<!--.*?)\\-->$/gms, '$1-->');
|
|
117479
|
+
};
|
|
117480
|
+
const mdastV6_mdastV6 = (doc, { rdmd }) => {
|
|
117481
|
+
const [_normalizedDoc] = rdmd.setup(doc);
|
|
117482
|
+
const normalizedDoc = migrationNormalize(_normalizedDoc);
|
|
117483
|
+
const proc = rdmd.processor().use(migrationTransformers).data('rdmd', rdmd);
|
|
117484
|
+
const tree = proc.parse(normalizedDoc);
|
|
117485
|
+
proc.runSync(tree, normalizedDoc);
|
|
117486
|
+
return tree;
|
|
117487
|
+
};
|
|
117488
|
+
/* harmony default export */ const lib_mdastV6 = ((/* unused pure expression or super */ null && (mdastV6_mdastV6)));
|
|
117489
|
+
|
|
117377
117490
|
;// ./processor/compile/anchor.ts
|
|
117378
117491
|
|
|
117379
117492
|
|
|
@@ -121272,6 +121385,7 @@ function syntax_mdxComponent() {
|
|
|
121272
121385
|
|
|
121273
121386
|
|
|
121274
121387
|
|
|
121388
|
+
|
|
121275
121389
|
|
|
121276
121390
|
|
|
121277
121391
|
const buildInlineMdProcessor = (safeMode) => {
|
|
@@ -121279,7 +121393,7 @@ const buildInlineMdProcessor = (safeMode) => {
|
|
|
121279
121393
|
// body (e.g. a `<Callout>`) is captured as one html node. Without it, blank
|
|
121280
121394
|
// lines between rows let CommonMark HTML block type 6 fragment the table and
|
|
121281
121395
|
// its rows spill out as text / indented code blocks (CX-3705).
|
|
121282
|
-
const micromarkExts = [syntax_jsxTable(), syntax_mdxComponent(), syntax_gemoji(), legacyVariable(), syntax_magicBlock()];
|
|
121396
|
+
const micromarkExts = [disableIndentedCode, syntax_jsxTable(), syntax_mdxComponent(), syntax_gemoji(), legacyVariable(), syntax_magicBlock()];
|
|
121283
121397
|
const fromMarkdownExts = [
|
|
121284
121398
|
jsx_table_jsxTableFromMarkdown(),
|
|
121285
121399
|
mdx_component_mdxComponentFromMarkdown(),
|
|
@@ -122588,71 +122702,6 @@ const generateSlugForHeadings = () => (tree) => {
|
|
|
122588
122702
|
// EXTERNAL MODULE: ./node_modules/@readme/variable/dist/index.js
|
|
122589
122703
|
var variable_dist = __webpack_require__(4355);
|
|
122590
122704
|
var variable_dist_default = /*#__PURE__*/__webpack_require__.n(variable_dist);
|
|
122591
|
-
;// ./node_modules/rehype-parse/lib/index.js
|
|
122592
|
-
/**
|
|
122593
|
-
* @import {Root} from 'hast'
|
|
122594
|
-
* @import {Options as FromHtmlOptions} from 'hast-util-from-html'
|
|
122595
|
-
* @import {Parser, Processor} from 'unified'
|
|
122596
|
-
*/
|
|
122597
|
-
|
|
122598
|
-
/**
|
|
122599
|
-
* @typedef {Omit<FromHtmlOptions, 'onerror'> & RehypeParseFields} Options
|
|
122600
|
-
* Configuration.
|
|
122601
|
-
*
|
|
122602
|
-
* @typedef RehypeParseFields
|
|
122603
|
-
* Extra fields.
|
|
122604
|
-
* @property {boolean | null | undefined} [emitParseErrors=false]
|
|
122605
|
-
* Whether to emit parse errors while parsing (default: `false`).
|
|
122606
|
-
*
|
|
122607
|
-
* > 👉 **Note**: parse errors are currently being added to HTML.
|
|
122608
|
-
* > Not all errors emitted by parse5 (or us) are specced yet.
|
|
122609
|
-
* > Some documentation may still be missing.
|
|
122610
|
-
*/
|
|
122611
|
-
|
|
122612
|
-
|
|
122613
|
-
|
|
122614
|
-
/**
|
|
122615
|
-
* Plugin to add support for parsing from HTML.
|
|
122616
|
-
*
|
|
122617
|
-
* > 👉 **Note**: this is not an XML parser.
|
|
122618
|
-
* > It supports SVG as embedded in HTML.
|
|
122619
|
-
* > It does not support the features available in XML.
|
|
122620
|
-
* > Passing SVG files might break but fragments of modern SVG should be fine.
|
|
122621
|
-
* > Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.
|
|
122622
|
-
*
|
|
122623
|
-
* @param {Options | null | undefined} [options]
|
|
122624
|
-
* Configuration (optional).
|
|
122625
|
-
* @returns {undefined}
|
|
122626
|
-
* Nothing.
|
|
122627
|
-
*/
|
|
122628
|
-
function rehypeParse(options) {
|
|
122629
|
-
/** @type {Processor<Root>} */
|
|
122630
|
-
// @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.
|
|
122631
|
-
const self = this
|
|
122632
|
-
const {emitParseErrors, ...settings} = {...self.data('settings'), ...options}
|
|
122633
|
-
|
|
122634
|
-
self.parser = parser
|
|
122635
|
-
|
|
122636
|
-
/**
|
|
122637
|
-
* @type {Parser<Root>}
|
|
122638
|
-
*/
|
|
122639
|
-
function parser(document, file) {
|
|
122640
|
-
return fromHtml(document, {
|
|
122641
|
-
...settings,
|
|
122642
|
-
onerror: emitParseErrors
|
|
122643
|
-
? function (message) {
|
|
122644
|
-
if (file.path) {
|
|
122645
|
-
message.name = file.path + ':' + message.name
|
|
122646
|
-
message.file = file.path
|
|
122647
|
-
}
|
|
122648
|
-
|
|
122649
|
-
file.messages.push(message)
|
|
122650
|
-
}
|
|
122651
|
-
: undefined
|
|
122652
|
-
})
|
|
122653
|
-
}
|
|
122654
|
-
}
|
|
122655
|
-
|
|
122656
122705
|
;// ./node_modules/hast-util-to-html/lib/handle/comment.js
|
|
122657
122706
|
/**
|
|
122658
122707
|
* @typedef {import('hast').Comment} Comment
|
|
@@ -126998,6 +127047,7 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
126998
127047
|
// Parser extension for MDX expressions {}
|
|
126999
127048
|
const mdxExprTextOnly = mdxExpressionLenient();
|
|
127000
127049
|
const micromarkExts = [
|
|
127050
|
+
disableIndentedCode,
|
|
127001
127051
|
syntax_jsxTable(),
|
|
127002
127052
|
syntax_magicBlock(),
|
|
127003
127053
|
syntax_mdxComponent(),
|
|
@@ -127674,6 +127724,7 @@ async function stripComments(doc, { mdx, mdxish } = {}) {
|
|
|
127674
127724
|
|
|
127675
127725
|
|
|
127676
127726
|
|
|
127727
|
+
|
|
127677
127728
|
;// ./lib/render-fixture/renderFixture.ts
|
|
127678
127729
|
|
|
127679
127730
|
|