@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
package/dist/main.node.js
CHANGED
|
@@ -19286,6 +19286,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
19286
19286
|
extractToc: () => (/* reexport */ lib_extractToc),
|
|
19287
19287
|
gemojiRegex: () => (/* reexport */ gemoji_regex),
|
|
19288
19288
|
hast: () => (/* reexport */ lib_hast),
|
|
19289
|
+
htmlToMarkdown: () => (/* reexport */ htmlToMarkdown),
|
|
19289
19290
|
mdast: () => (/* reexport */ lib_mdast),
|
|
19290
19291
|
mdastV6: () => (/* reexport */ lib_mdastV6),
|
|
19291
19292
|
mdx: () => (/* reexport */ lib_mdx),
|
|
@@ -74734,6 +74735,13 @@ const mdast = (text, opts = {}) => {
|
|
|
74734
74735
|
* to parse expressions containing JSX.
|
|
74735
74736
|
*/
|
|
74736
74737
|
const jsxAcornParser = Parser.extend(acorn_jsx_default()());
|
|
74738
|
+
/**
|
|
74739
|
+
* Disables CommonMark's indented-code-block construct (4+ spaces)
|
|
74740
|
+
* The micromark tokenizers use follow the CommonMark specification: https://spec.commonmark.org/0.28/#indented-code-blocks
|
|
74741
|
+
* So any lines indented 4+ spaces are considered as a code block,
|
|
74742
|
+
* which is unexpected from users that used MDX before.
|
|
74743
|
+
*/
|
|
74744
|
+
const disableIndentedCode = { disable: { null: ['codeIndented'] } };
|
|
74737
74745
|
/**
|
|
74738
74746
|
* Evaluate a JavaScript expression source and return its value.
|
|
74739
74747
|
*
|
|
@@ -112718,185 +112726,70 @@ const hast = (text, opts = {}) => {
|
|
|
112718
112726
|
};
|
|
112719
112727
|
/* harmony default export */ const lib_hast = (hast);
|
|
112720
112728
|
|
|
112721
|
-
;// ./
|
|
112722
|
-
|
|
112723
|
-
|
|
112724
|
-
|
|
112725
|
-
|
|
112726
|
-
|
|
112727
|
-
const prev = parent.children[index - 1];
|
|
112728
|
-
if (!('value' in prev) || prev.value.endsWith(' ') || prev.type === 'escape')
|
|
112729
|
-
return;
|
|
112730
|
-
parent.children.splice(index, 0, { type: 'text', value: ' ' });
|
|
112731
|
-
};
|
|
112732
|
-
const addSpaceAfter = (index, parent) => {
|
|
112733
|
-
if (!(index < parent.children.length - 1 && parent.children[index + 1]))
|
|
112734
|
-
return;
|
|
112735
|
-
const nextChild = parent.children[index + 1];
|
|
112736
|
-
if (!('value' in nextChild) || nextChild.value.startsWith(' '))
|
|
112737
|
-
return;
|
|
112738
|
-
parent.children.splice(index + 1, 0, { type: 'text', value: ' ' });
|
|
112739
|
-
};
|
|
112740
|
-
const trimEmphasis = (node, index, parent) => {
|
|
112741
|
-
let trimmed = false;
|
|
112742
|
-
visit(node, 'text', (child) => {
|
|
112743
|
-
const newValue = child.value.trimStart();
|
|
112744
|
-
if (newValue !== child.value) {
|
|
112745
|
-
trimmed = true;
|
|
112746
|
-
child.value = newValue;
|
|
112747
|
-
}
|
|
112748
|
-
return EXIT;
|
|
112749
|
-
});
|
|
112750
|
-
visit(node, 'text', (child) => {
|
|
112751
|
-
const newValue = child.value.trimEnd();
|
|
112752
|
-
if (newValue !== child.value) {
|
|
112753
|
-
trimmed = true;
|
|
112754
|
-
child.value = newValue;
|
|
112755
|
-
}
|
|
112756
|
-
return EXIT;
|
|
112757
|
-
}, true);
|
|
112758
|
-
if (trimmed) {
|
|
112759
|
-
addSpaceBefore(index, parent);
|
|
112760
|
-
addSpaceAfter(index, parent);
|
|
112761
|
-
}
|
|
112762
|
-
};
|
|
112763
|
-
const emphasisTransfomer = () => (tree) => {
|
|
112764
|
-
visit(tree, emphasis_strongTest, trimEmphasis);
|
|
112765
|
-
return tree;
|
|
112766
|
-
};
|
|
112767
|
-
/* harmony default export */ const migration_emphasis = (emphasisTransfomer);
|
|
112729
|
+
;// ./node_modules/rehype-parse/lib/index.js
|
|
112730
|
+
/**
|
|
112731
|
+
* @import {Root} from 'hast'
|
|
112732
|
+
* @import {Options as FromHtmlOptions} from 'hast-util-from-html'
|
|
112733
|
+
* @import {Parser, Processor} from 'unified'
|
|
112734
|
+
*/
|
|
112768
112735
|
|
|
112769
|
-
|
|
112736
|
+
/**
|
|
112737
|
+
* @typedef {Omit<FromHtmlOptions, 'onerror'> & RehypeParseFields} Options
|
|
112738
|
+
* Configuration.
|
|
112739
|
+
*
|
|
112740
|
+
* @typedef RehypeParseFields
|
|
112741
|
+
* Extra fields.
|
|
112742
|
+
* @property {boolean | null | undefined} [emitParseErrors=false]
|
|
112743
|
+
* Whether to emit parse errors while parsing (default: `false`).
|
|
112744
|
+
*
|
|
112745
|
+
* > 👉 **Note**: parse errors are currently being added to HTML.
|
|
112746
|
+
* > Not all errors emitted by parse5 (or us) are specced yet.
|
|
112747
|
+
* > Some documentation may still be missing.
|
|
112748
|
+
*/
|
|
112770
112749
|
|
|
112771
|
-
const images_imageTransformer = () => tree => {
|
|
112772
|
-
visit(tree, 'image', (image) => {
|
|
112773
|
-
if (image.data?.hProperties?.className === 'border') {
|
|
112774
|
-
image.data.hProperties.border = true;
|
|
112775
|
-
}
|
|
112776
|
-
});
|
|
112777
|
-
};
|
|
112778
|
-
/* harmony default export */ const migration_images = (images_imageTransformer);
|
|
112779
112750
|
|
|
112780
|
-
;// ./processor/migration/linkReference.ts
|
|
112781
112751
|
|
|
112782
|
-
|
|
112783
|
-
|
|
112784
|
-
|
|
112785
|
-
|
|
112786
|
-
|
|
112787
|
-
|
|
112788
|
-
|
|
112789
|
-
|
|
112790
|
-
|
|
112791
|
-
|
|
112792
|
-
|
|
112793
|
-
|
|
112794
|
-
|
|
112795
|
-
|
|
112796
|
-
|
|
112797
|
-
|
|
112798
|
-
|
|
112799
|
-
|
|
112800
|
-
|
|
112752
|
+
/**
|
|
112753
|
+
* Plugin to add support for parsing from HTML.
|
|
112754
|
+
*
|
|
112755
|
+
* > 👉 **Note**: this is not an XML parser.
|
|
112756
|
+
* > It supports SVG as embedded in HTML.
|
|
112757
|
+
* > It does not support the features available in XML.
|
|
112758
|
+
* > Passing SVG files might break but fragments of modern SVG should be fine.
|
|
112759
|
+
* > Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.
|
|
112760
|
+
*
|
|
112761
|
+
* @param {Options | null | undefined} [options]
|
|
112762
|
+
* Configuration (optional).
|
|
112763
|
+
* @returns {undefined}
|
|
112764
|
+
* Nothing.
|
|
112765
|
+
*/
|
|
112766
|
+
function rehypeParse(options) {
|
|
112767
|
+
/** @type {Processor<Root>} */
|
|
112768
|
+
// @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.
|
|
112769
|
+
const self = this
|
|
112770
|
+
const {emitParseErrors, ...settings} = {...self.data('settings'), ...options}
|
|
112801
112771
|
|
|
112802
|
-
|
|
112772
|
+
self.parser = parser
|
|
112803
112773
|
|
|
112804
|
-
|
|
112805
|
-
|
|
112806
|
-
|
|
112807
|
-
|
|
112808
|
-
|
|
112809
|
-
|
|
112810
|
-
|
|
112811
|
-
|
|
112812
|
-
|
|
112813
|
-
|
|
112814
|
-
|
|
112815
|
-
// This is a perfectly valid list. But when you put that text into a table
|
|
112816
|
-
// cell, the editor does **bad** things. After a save and load cycle, it gets
|
|
112817
|
-
// converted to this:
|
|
112818
|
-
//
|
|
112819
|
-
// ```
|
|
112820
|
-
// \_ item 1
|
|
112821
|
-
// \_ item 2
|
|
112822
|
-
// \* item 3
|
|
112823
|
-
// ```
|
|
112824
|
-
//
|
|
112825
|
-
// The following regex attempts to detect this pattern, and we'll convert it to
|
|
112826
|
-
// something more standard.
|
|
112827
|
-
const psuedoListRegex = /^(?![ \t]*([*_]+).*\1[ \t]*$)(?<ws>[ \t]*)\\?([*_])\s*(?<item>.*)$/gm;
|
|
112828
|
-
const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
112829
|
-
let json;
|
|
112830
|
-
try {
|
|
112831
|
-
const { position } = table;
|
|
112832
|
-
if (position) {
|
|
112833
|
-
json = JSON.parse(vfile
|
|
112834
|
-
.toString()
|
|
112835
|
-
.slice(position.start.offset, position.end.offset)
|
|
112836
|
-
.replace(/.*\[block:parameters\](.*)\[\/block\].*/s, '$1'));
|
|
112837
|
-
}
|
|
112838
|
-
}
|
|
112839
|
-
catch (err) {
|
|
112840
|
-
/**
|
|
112841
|
-
* This failure case is already handled by the following logic. Plus,
|
|
112842
|
-
* because it's being handled internally, there's no way for our
|
|
112843
|
-
* migration script to catch the error or keep track of it, and it just
|
|
112844
|
-
* ends up blowing up the output logs.
|
|
112845
|
-
*/
|
|
112846
|
-
// console.error(err);
|
|
112847
|
-
}
|
|
112848
|
-
visit(table, 'tableRow', (row, i) => {
|
|
112849
|
-
visit(row, 'tableCell', (cell, j) => {
|
|
112850
|
-
let children = cell.children;
|
|
112851
|
-
if (json && json.data[magicIndex(i, j)]) {
|
|
112852
|
-
const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
|
|
112853
|
-
children = rdmd.mdast(string).children;
|
|
112774
|
+
/**
|
|
112775
|
+
* @type {Parser<Root>}
|
|
112776
|
+
*/
|
|
112777
|
+
function parser(document, file) {
|
|
112778
|
+
return fromHtml(document, {
|
|
112779
|
+
...settings,
|
|
112780
|
+
onerror: emitParseErrors
|
|
112781
|
+
? function (message) {
|
|
112782
|
+
if (file.path) {
|
|
112783
|
+
message.name = file.path + ':' + message.name
|
|
112784
|
+
message.file = file.path
|
|
112854
112785
|
}
|
|
112855
|
-
cell.children =
|
|
112856
|
-
children.length > 1 && !children.some(isInlineHtml)
|
|
112857
|
-
? children
|
|
112858
|
-
: [{ type: 'paragraph', children }];
|
|
112859
|
-
return SKIP;
|
|
112860
|
-
});
|
|
112861
|
-
return SKIP;
|
|
112862
|
-
});
|
|
112863
|
-
visit(table, 'inlineCode', (code) => {
|
|
112864
|
-
if (code.value.includes('\n')) {
|
|
112865
|
-
code.type = 'code';
|
|
112866
|
-
}
|
|
112867
|
-
});
|
|
112868
|
-
};
|
|
112869
|
-
function tableCellTransformer() {
|
|
112870
|
-
const rdmd = this.data('rdmd');
|
|
112871
|
-
return (tree, vfile) => {
|
|
112872
|
-
visit(tree, 'table', migrateTableCells(vfile, rdmd));
|
|
112873
|
-
return tree;
|
|
112874
|
-
};
|
|
112875
|
-
}
|
|
112876
|
-
/* harmony default export */ const table_cell = (tableCellTransformer);
|
|
112877
112786
|
|
|
112878
|
-
|
|
112879
|
-
|
|
112880
|
-
|
|
112881
|
-
|
|
112882
|
-
|
|
112883
|
-
|
|
112884
|
-
/* harmony default export */ const migration = (transformers);
|
|
112885
|
-
|
|
112886
|
-
;// ./lib/mdastV6.ts
|
|
112887
|
-
|
|
112888
|
-
const migrationNormalize = (doc) => {
|
|
112889
|
-
return doc.replaceAll(/^(<!--.*?)\\-->$/gms, '$1-->');
|
|
112890
|
-
};
|
|
112891
|
-
const mdastV6 = (doc, { rdmd }) => {
|
|
112892
|
-
const [_normalizedDoc] = rdmd.setup(doc);
|
|
112893
|
-
const normalizedDoc = migrationNormalize(_normalizedDoc);
|
|
112894
|
-
const proc = rdmd.processor().use(migration).data('rdmd', rdmd);
|
|
112895
|
-
const tree = proc.parse(normalizedDoc);
|
|
112896
|
-
proc.runSync(tree, normalizedDoc);
|
|
112897
|
-
return tree;
|
|
112898
|
-
};
|
|
112899
|
-
/* harmony default export */ const lib_mdastV6 = (mdastV6);
|
|
112787
|
+
file.messages.push(message)
|
|
112788
|
+
}
|
|
112789
|
+
: undefined
|
|
112790
|
+
})
|
|
112791
|
+
}
|
|
112792
|
+
}
|
|
112900
112793
|
|
|
112901
112794
|
;// ./node_modules/hast-util-is-element/lib/index.js
|
|
112902
112795
|
/**
|
|
@@ -117423,6 +117316,227 @@ function rehypeRemark(destination, options) {
|
|
|
117423
117316
|
}
|
|
117424
117317
|
}
|
|
117425
117318
|
|
|
117319
|
+
;// ./lib/htmlToMarkdown.ts
|
|
117320
|
+
|
|
117321
|
+
|
|
117322
|
+
|
|
117323
|
+
|
|
117324
|
+
|
|
117325
|
+
/**
|
|
117326
|
+
* Converts an HTML fragment to GitHub-flavored Markdown.
|
|
117327
|
+
*
|
|
117328
|
+
* `remark-gfm` is load-bearing: without it, `<table>` and `<del>` input throws
|
|
117329
|
+
* at serialization. `iframe` (default: becomes a link) and `noscript` (default:
|
|
117330
|
+
* keeps its text) are dropped by the handlers so raw markup never leaks;
|
|
117331
|
+
* `script`, `style`, and `template` already drop by default and are overridden
|
|
117332
|
+
* defensively. HTML comments are dropped via `nodeHandlers`.
|
|
117333
|
+
*/
|
|
117334
|
+
const processor = unified()
|
|
117335
|
+
.use(rehypeParse, { fragment: true })
|
|
117336
|
+
.use(rehypeRemark, {
|
|
117337
|
+
// A comment is a `comment` node, not an element, so it goes in
|
|
117338
|
+
// `nodeHandlers` rather than `handlers`.
|
|
117339
|
+
handlers: {
|
|
117340
|
+
iframe: () => undefined,
|
|
117341
|
+
noscript: () => undefined,
|
|
117342
|
+
script: () => undefined,
|
|
117343
|
+
style: () => undefined,
|
|
117344
|
+
template: () => undefined,
|
|
117345
|
+
},
|
|
117346
|
+
nodeHandlers: { comment: () => undefined },
|
|
117347
|
+
})
|
|
117348
|
+
.use(remarkGfm)
|
|
117349
|
+
.use(remarkStringify, { bullet: '-', emphasis: '_', fences: true });
|
|
117350
|
+
/**
|
|
117351
|
+
* Returns the Markdown form of `html`, or an empty string when there is no
|
|
117352
|
+
* usable input. Synchronous, so it can run inside non-async serializers.
|
|
117353
|
+
*/
|
|
117354
|
+
function htmlToMarkdown(html) {
|
|
117355
|
+
if (typeof html !== 'string' || !html.trim())
|
|
117356
|
+
return '';
|
|
117357
|
+
return processor.processSync(html).toString().trim();
|
|
117358
|
+
}
|
|
117359
|
+
|
|
117360
|
+
;// ./processor/migration/emphasis.ts
|
|
117361
|
+
|
|
117362
|
+
const emphasis_strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
|
|
117363
|
+
const addSpaceBefore = (index, parent) => {
|
|
117364
|
+
if (!(index > 0 && parent.children[index - 1]))
|
|
117365
|
+
return;
|
|
117366
|
+
const prev = parent.children[index - 1];
|
|
117367
|
+
if (!('value' in prev) || prev.value.endsWith(' ') || prev.type === 'escape')
|
|
117368
|
+
return;
|
|
117369
|
+
parent.children.splice(index, 0, { type: 'text', value: ' ' });
|
|
117370
|
+
};
|
|
117371
|
+
const addSpaceAfter = (index, parent) => {
|
|
117372
|
+
if (!(index < parent.children.length - 1 && parent.children[index + 1]))
|
|
117373
|
+
return;
|
|
117374
|
+
const nextChild = parent.children[index + 1];
|
|
117375
|
+
if (!('value' in nextChild) || nextChild.value.startsWith(' '))
|
|
117376
|
+
return;
|
|
117377
|
+
parent.children.splice(index + 1, 0, { type: 'text', value: ' ' });
|
|
117378
|
+
};
|
|
117379
|
+
const trimEmphasis = (node, index, parent) => {
|
|
117380
|
+
let trimmed = false;
|
|
117381
|
+
visit(node, 'text', (child) => {
|
|
117382
|
+
const newValue = child.value.trimStart();
|
|
117383
|
+
if (newValue !== child.value) {
|
|
117384
|
+
trimmed = true;
|
|
117385
|
+
child.value = newValue;
|
|
117386
|
+
}
|
|
117387
|
+
return EXIT;
|
|
117388
|
+
});
|
|
117389
|
+
visit(node, 'text', (child) => {
|
|
117390
|
+
const newValue = child.value.trimEnd();
|
|
117391
|
+
if (newValue !== child.value) {
|
|
117392
|
+
trimmed = true;
|
|
117393
|
+
child.value = newValue;
|
|
117394
|
+
}
|
|
117395
|
+
return EXIT;
|
|
117396
|
+
}, true);
|
|
117397
|
+
if (trimmed) {
|
|
117398
|
+
addSpaceBefore(index, parent);
|
|
117399
|
+
addSpaceAfter(index, parent);
|
|
117400
|
+
}
|
|
117401
|
+
};
|
|
117402
|
+
const emphasisTransfomer = () => (tree) => {
|
|
117403
|
+
visit(tree, emphasis_strongTest, trimEmphasis);
|
|
117404
|
+
return tree;
|
|
117405
|
+
};
|
|
117406
|
+
/* harmony default export */ const migration_emphasis = (emphasisTransfomer);
|
|
117407
|
+
|
|
117408
|
+
;// ./processor/migration/images.ts
|
|
117409
|
+
|
|
117410
|
+
const images_imageTransformer = () => tree => {
|
|
117411
|
+
visit(tree, 'image', (image) => {
|
|
117412
|
+
if (image.data?.hProperties?.className === 'border') {
|
|
117413
|
+
image.data.hProperties.border = true;
|
|
117414
|
+
}
|
|
117415
|
+
});
|
|
117416
|
+
};
|
|
117417
|
+
/* harmony default export */ const migration_images = (images_imageTransformer);
|
|
117418
|
+
|
|
117419
|
+
;// ./processor/migration/linkReference.ts
|
|
117420
|
+
|
|
117421
|
+
const linkReferenceTransformer = () => (tree) => {
|
|
117422
|
+
visit(tree, 'linkReference', (node, index, parent) => {
|
|
117423
|
+
const definitions = {};
|
|
117424
|
+
visit(tree, 'definition', (def) => {
|
|
117425
|
+
definitions[def.identifier] = def;
|
|
117426
|
+
});
|
|
117427
|
+
if (node.label === node.identifier && parent) {
|
|
117428
|
+
if (!(node.identifier in definitions)) {
|
|
117429
|
+
parent.children[index] = {
|
|
117430
|
+
type: 'text',
|
|
117431
|
+
value: `[${node.label}]`,
|
|
117432
|
+
position: node.position,
|
|
117433
|
+
};
|
|
117434
|
+
}
|
|
117435
|
+
}
|
|
117436
|
+
});
|
|
117437
|
+
return tree;
|
|
117438
|
+
};
|
|
117439
|
+
/* harmony default export */ const migration_linkReference = (linkReferenceTransformer);
|
|
117440
|
+
|
|
117441
|
+
;// ./processor/migration/table-cell.ts
|
|
117442
|
+
|
|
117443
|
+
const magicIndex = (i, j) => `${i === 0 ? 'h' : `${i - 1}`}-${j}`;
|
|
117444
|
+
const isInlineHtml = node => node.type === 'html' && !node.block;
|
|
117445
|
+
// @note: This regex is detect malformed lists that were created by the
|
|
117446
|
+
// markdown editor. Consider the following markdown:
|
|
117447
|
+
//
|
|
117448
|
+
// ```
|
|
117449
|
+
// * item 1
|
|
117450
|
+
// * item 2
|
|
117451
|
+
// * item 3
|
|
117452
|
+
// ```
|
|
117453
|
+
//
|
|
117454
|
+
// This is a perfectly valid list. But when you put that text into a table
|
|
117455
|
+
// cell, the editor does **bad** things. After a save and load cycle, it gets
|
|
117456
|
+
// converted to this:
|
|
117457
|
+
//
|
|
117458
|
+
// ```
|
|
117459
|
+
// \_ item 1
|
|
117460
|
+
// \_ item 2
|
|
117461
|
+
// \* item 3
|
|
117462
|
+
// ```
|
|
117463
|
+
//
|
|
117464
|
+
// The following regex attempts to detect this pattern, and we'll convert it to
|
|
117465
|
+
// something more standard.
|
|
117466
|
+
const psuedoListRegex = /^(?![ \t]*([*_]+).*\1[ \t]*$)(?<ws>[ \t]*)\\?([*_])\s*(?<item>.*)$/gm;
|
|
117467
|
+
const migrateTableCells = (vfile, rdmd) => (table) => {
|
|
117468
|
+
let json;
|
|
117469
|
+
try {
|
|
117470
|
+
const { position } = table;
|
|
117471
|
+
if (position) {
|
|
117472
|
+
json = JSON.parse(vfile
|
|
117473
|
+
.toString()
|
|
117474
|
+
.slice(position.start.offset, position.end.offset)
|
|
117475
|
+
.replace(/.*\[block:parameters\](.*)\[\/block\].*/s, '$1'));
|
|
117476
|
+
}
|
|
117477
|
+
}
|
|
117478
|
+
catch (err) {
|
|
117479
|
+
/**
|
|
117480
|
+
* This failure case is already handled by the following logic. Plus,
|
|
117481
|
+
* because it's being handled internally, there's no way for our
|
|
117482
|
+
* migration script to catch the error or keep track of it, and it just
|
|
117483
|
+
* ends up blowing up the output logs.
|
|
117484
|
+
*/
|
|
117485
|
+
// console.error(err);
|
|
117486
|
+
}
|
|
117487
|
+
visit(table, 'tableRow', (row, i) => {
|
|
117488
|
+
visit(row, 'tableCell', (cell, j) => {
|
|
117489
|
+
let children = cell.children;
|
|
117490
|
+
if (json && json.data[magicIndex(i, j)]) {
|
|
117491
|
+
const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
|
|
117492
|
+
children = rdmd.mdast(string).children;
|
|
117493
|
+
}
|
|
117494
|
+
cell.children =
|
|
117495
|
+
children.length > 1 && !children.some(isInlineHtml)
|
|
117496
|
+
? children
|
|
117497
|
+
: [{ type: 'paragraph', children }];
|
|
117498
|
+
return SKIP;
|
|
117499
|
+
});
|
|
117500
|
+
return SKIP;
|
|
117501
|
+
});
|
|
117502
|
+
visit(table, 'inlineCode', (code) => {
|
|
117503
|
+
if (code.value.includes('\n')) {
|
|
117504
|
+
code.type = 'code';
|
|
117505
|
+
}
|
|
117506
|
+
});
|
|
117507
|
+
};
|
|
117508
|
+
function tableCellTransformer() {
|
|
117509
|
+
const rdmd = this.data('rdmd');
|
|
117510
|
+
return (tree, vfile) => {
|
|
117511
|
+
visit(tree, 'table', migrateTableCells(vfile, rdmd));
|
|
117512
|
+
return tree;
|
|
117513
|
+
};
|
|
117514
|
+
}
|
|
117515
|
+
/* harmony default export */ const table_cell = (tableCellTransformer);
|
|
117516
|
+
|
|
117517
|
+
;// ./processor/migration/index.ts
|
|
117518
|
+
|
|
117519
|
+
|
|
117520
|
+
|
|
117521
|
+
|
|
117522
|
+
const transformers = [migration_emphasis, migration_images, migration_linkReference, table_cell];
|
|
117523
|
+
/* harmony default export */ const migration = (transformers);
|
|
117524
|
+
|
|
117525
|
+
;// ./lib/mdastV6.ts
|
|
117526
|
+
|
|
117527
|
+
const migrationNormalize = (doc) => {
|
|
117528
|
+
return doc.replaceAll(/^(<!--.*?)\\-->$/gms, '$1-->');
|
|
117529
|
+
};
|
|
117530
|
+
const mdastV6 = (doc, { rdmd }) => {
|
|
117531
|
+
const [_normalizedDoc] = rdmd.setup(doc);
|
|
117532
|
+
const normalizedDoc = migrationNormalize(_normalizedDoc);
|
|
117533
|
+
const proc = rdmd.processor().use(migration).data('rdmd', rdmd);
|
|
117534
|
+
const tree = proc.parse(normalizedDoc);
|
|
117535
|
+
proc.runSync(tree, normalizedDoc);
|
|
117536
|
+
return tree;
|
|
117537
|
+
};
|
|
117538
|
+
/* harmony default export */ const lib_mdastV6 = (mdastV6);
|
|
117539
|
+
|
|
117426
117540
|
;// ./processor/compile/anchor.ts
|
|
117427
117541
|
|
|
117428
117542
|
|
|
@@ -122741,6 +122855,7 @@ function mdxComponent() {
|
|
|
122741
122855
|
|
|
122742
122856
|
|
|
122743
122857
|
|
|
122858
|
+
|
|
122744
122859
|
|
|
122745
122860
|
|
|
122746
122861
|
const buildInlineMdProcessor = (safeMode) => {
|
|
@@ -122748,7 +122863,7 @@ const buildInlineMdProcessor = (safeMode) => {
|
|
|
122748
122863
|
// body (e.g. a `<Callout>`) is captured as one html node. Without it, blank
|
|
122749
122864
|
// lines between rows let CommonMark HTML block type 6 fragment the table and
|
|
122750
122865
|
// its rows spill out as text / indented code blocks (CX-3705).
|
|
122751
|
-
const micromarkExts = [jsxTable(), mdxComponent(), syntax_gemoji(), legacyVariable(), magicBlock()];
|
|
122866
|
+
const micromarkExts = [disableIndentedCode, jsxTable(), mdxComponent(), syntax_gemoji(), legacyVariable(), magicBlock()];
|
|
122752
122867
|
const fromMarkdownExts = [
|
|
122753
122868
|
jsxTableFromMarkdown(),
|
|
122754
122869
|
mdxComponentFromMarkdown(),
|
|
@@ -124059,71 +124174,6 @@ const generateSlugForHeadings = () => (tree) => {
|
|
|
124059
124174
|
// EXTERNAL MODULE: ./node_modules/@readme/variable/dist/index.js
|
|
124060
124175
|
var variable_dist = __webpack_require__(4355);
|
|
124061
124176
|
var variable_dist_default = /*#__PURE__*/__webpack_require__.n(variable_dist);
|
|
124062
|
-
;// ./node_modules/rehype-parse/lib/index.js
|
|
124063
|
-
/**
|
|
124064
|
-
* @import {Root} from 'hast'
|
|
124065
|
-
* @import {Options as FromHtmlOptions} from 'hast-util-from-html'
|
|
124066
|
-
* @import {Parser, Processor} from 'unified'
|
|
124067
|
-
*/
|
|
124068
|
-
|
|
124069
|
-
/**
|
|
124070
|
-
* @typedef {Omit<FromHtmlOptions, 'onerror'> & RehypeParseFields} Options
|
|
124071
|
-
* Configuration.
|
|
124072
|
-
*
|
|
124073
|
-
* @typedef RehypeParseFields
|
|
124074
|
-
* Extra fields.
|
|
124075
|
-
* @property {boolean | null | undefined} [emitParseErrors=false]
|
|
124076
|
-
* Whether to emit parse errors while parsing (default: `false`).
|
|
124077
|
-
*
|
|
124078
|
-
* > 👉 **Note**: parse errors are currently being added to HTML.
|
|
124079
|
-
* > Not all errors emitted by parse5 (or us) are specced yet.
|
|
124080
|
-
* > Some documentation may still be missing.
|
|
124081
|
-
*/
|
|
124082
|
-
|
|
124083
|
-
|
|
124084
|
-
|
|
124085
|
-
/**
|
|
124086
|
-
* Plugin to add support for parsing from HTML.
|
|
124087
|
-
*
|
|
124088
|
-
* > 👉 **Note**: this is not an XML parser.
|
|
124089
|
-
* > It supports SVG as embedded in HTML.
|
|
124090
|
-
* > It does not support the features available in XML.
|
|
124091
|
-
* > Passing SVG files might break but fragments of modern SVG should be fine.
|
|
124092
|
-
* > Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.
|
|
124093
|
-
*
|
|
124094
|
-
* @param {Options | null | undefined} [options]
|
|
124095
|
-
* Configuration (optional).
|
|
124096
|
-
* @returns {undefined}
|
|
124097
|
-
* Nothing.
|
|
124098
|
-
*/
|
|
124099
|
-
function rehypeParse(options) {
|
|
124100
|
-
/** @type {Processor<Root>} */
|
|
124101
|
-
// @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.
|
|
124102
|
-
const self = this
|
|
124103
|
-
const {emitParseErrors, ...settings} = {...self.data('settings'), ...options}
|
|
124104
|
-
|
|
124105
|
-
self.parser = parser
|
|
124106
|
-
|
|
124107
|
-
/**
|
|
124108
|
-
* @type {Parser<Root>}
|
|
124109
|
-
*/
|
|
124110
|
-
function parser(document, file) {
|
|
124111
|
-
return fromHtml(document, {
|
|
124112
|
-
...settings,
|
|
124113
|
-
onerror: emitParseErrors
|
|
124114
|
-
? function (message) {
|
|
124115
|
-
if (file.path) {
|
|
124116
|
-
message.name = file.path + ':' + message.name
|
|
124117
|
-
message.file = file.path
|
|
124118
|
-
}
|
|
124119
|
-
|
|
124120
|
-
file.messages.push(message)
|
|
124121
|
-
}
|
|
124122
|
-
: undefined
|
|
124123
|
-
})
|
|
124124
|
-
}
|
|
124125
|
-
}
|
|
124126
|
-
|
|
124127
124177
|
;// ./lib/micromark/loose-html-entities/syntax.ts
|
|
124128
124178
|
|
|
124129
124179
|
|
|
@@ -127049,6 +127099,7 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
127049
127099
|
// Parser extension for MDX expressions {}
|
|
127050
127100
|
const mdxExprTextOnly = mdxExpressionLenient();
|
|
127051
127101
|
const micromarkExts = [
|
|
127102
|
+
disableIndentedCode,
|
|
127052
127103
|
jsxTable(),
|
|
127053
127104
|
magicBlock(),
|
|
127054
127105
|
mdxComponent(),
|
|
@@ -127833,6 +127884,7 @@ async function stripComments(doc, { mdx, mdxish } = {}) {
|
|
|
127833
127884
|
|
|
127834
127885
|
|
|
127835
127886
|
|
|
127887
|
+
|
|
127836
127888
|
;// ./index.tsx
|
|
127837
127889
|
|
|
127838
127890
|
|