@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 CHANGED
@@ -6,7 +6,7 @@ declare const utils: {
6
6
  getHref: typeof getHref;
7
7
  calloutIcons: {};
8
8
  };
9
- export { compile, exports, FLOW_TYPES, hast, INLINE_ONLY_PARENT_TYPES, run, mdast, mdastV6, mdx, mdxish, mdxishAstProcessor, mdxishMdastToMd, mdxishTags, extractToc, migrate, mix, plain, renderMdxish, remarkPlugins, stripComments, tags, } from './lib';
9
+ export { compile, exports, FLOW_TYPES, hast, htmlToMarkdown, INLINE_ONLY_PARENT_TYPES, run, mdast, mdastV6, mdx, mdxish, mdxishAstProcessor, mdxishMdastToMd, mdxishTags, extractToc, migrate, mix, plain, renderMdxish, remarkPlugins, stripComments, tags, } from './lib';
10
10
  export type { MdxishOpts, RenderMdxishOpts, RunOpts } from './lib';
11
11
  export { default as Owlmoji } from './lib/owlmoji';
12
12
  export { Components, utils };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns the Markdown form of `html`, or an empty string when there is no
3
+ * usable input. Synchronous, so it can run inside non-async serializers.
4
+ */
5
+ export default function htmlToMarkdown(html?: string | null): string;
@@ -4,6 +4,7 @@ export { default as astProcessor, remarkPlugins } from './ast-processor';
4
4
  export { default as compile } from './compile';
5
5
  export { default as exports } from './exports';
6
6
  export { default as hast } from './hast';
7
+ export { default as htmlToMarkdown } from './htmlToMarkdown';
7
8
  export { default as mdast } from './mdast';
8
9
  export { default as mdastV6 } from './mdastV6';
9
10
  export { default as mdx } from './mdx';
package/dist/main.js CHANGED
@@ -11602,6 +11602,7 @@ __webpack_require__.d(__webpack_exports__, {
11602
11602
  extractToc: () => (/* reexport */ lib_extractToc),
11603
11603
  gemojiRegex: () => (/* reexport */ gemoji_regex),
11604
11604
  hast: () => (/* reexport */ lib_hast),
11605
+ htmlToMarkdown: () => (/* reexport */ htmlToMarkdown),
11605
11606
  mdast: () => (/* reexport */ lib_mdast),
11606
11607
  mdastV6: () => (/* reexport */ lib_mdastV6),
11607
11608
  mdx: () => (/* reexport */ lib_mdx),
@@ -54510,6 +54511,13 @@ const mdast = (text, opts = {}) => {
54510
54511
  * to parse expressions containing JSX.
54511
54512
  */
54512
54513
  const jsxAcornParser = external_acorn_.Parser.extend(acorn_jsx_default()());
54514
+ /**
54515
+ * Disables CommonMark's indented-code-block construct (4+ spaces)
54516
+ * The micromark tokenizers use follow the CommonMark specification: https://spec.commonmark.org/0.28/#indented-code-blocks
54517
+ * So any lines indented 4+ spaces are considered as a code block,
54518
+ * which is unexpected from users that used MDX before.
54519
+ */
54520
+ const disableIndentedCode = { disable: { null: ['codeIndented'] } };
54513
54521
  /**
54514
54522
  * Evaluate a JavaScript expression source and return its value.
54515
54523
  *
@@ -92494,185 +92502,70 @@ const hast = (text, opts = {}) => {
92494
92502
  };
92495
92503
  /* harmony default export */ const lib_hast = (hast);
92496
92504
 
92497
- ;// ./processor/migration/emphasis.ts
92498
-
92499
- const emphasis_strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
92500
- const addSpaceBefore = (index, parent) => {
92501
- if (!(index > 0 && parent.children[index - 1]))
92502
- return;
92503
- const prev = parent.children[index - 1];
92504
- if (!('value' in prev) || prev.value.endsWith(' ') || prev.type === 'escape')
92505
- return;
92506
- parent.children.splice(index, 0, { type: 'text', value: ' ' });
92507
- };
92508
- const addSpaceAfter = (index, parent) => {
92509
- if (!(index < parent.children.length - 1 && parent.children[index + 1]))
92510
- return;
92511
- const nextChild = parent.children[index + 1];
92512
- if (!('value' in nextChild) || nextChild.value.startsWith(' '))
92513
- return;
92514
- parent.children.splice(index + 1, 0, { type: 'text', value: ' ' });
92515
- };
92516
- const trimEmphasis = (node, index, parent) => {
92517
- let trimmed = false;
92518
- visit(node, 'text', (child) => {
92519
- const newValue = child.value.trimStart();
92520
- if (newValue !== child.value) {
92521
- trimmed = true;
92522
- child.value = newValue;
92523
- }
92524
- return EXIT;
92525
- });
92526
- visit(node, 'text', (child) => {
92527
- const newValue = child.value.trimEnd();
92528
- if (newValue !== child.value) {
92529
- trimmed = true;
92530
- child.value = newValue;
92531
- }
92532
- return EXIT;
92533
- }, true);
92534
- if (trimmed) {
92535
- addSpaceBefore(index, parent);
92536
- addSpaceAfter(index, parent);
92537
- }
92538
- };
92539
- const emphasisTransfomer = () => (tree) => {
92540
- visit(tree, emphasis_strongTest, trimEmphasis);
92541
- return tree;
92542
- };
92543
- /* harmony default export */ const migration_emphasis = (emphasisTransfomer);
92505
+ ;// ./node_modules/rehype-parse/lib/index.js
92506
+ /**
92507
+ * @import {Root} from 'hast'
92508
+ * @import {Options as FromHtmlOptions} from 'hast-util-from-html'
92509
+ * @import {Parser, Processor} from 'unified'
92510
+ */
92544
92511
 
92545
- ;// ./processor/migration/images.ts
92512
+ /**
92513
+ * @typedef {Omit<FromHtmlOptions, 'onerror'> & RehypeParseFields} Options
92514
+ * Configuration.
92515
+ *
92516
+ * @typedef RehypeParseFields
92517
+ * Extra fields.
92518
+ * @property {boolean | null | undefined} [emitParseErrors=false]
92519
+ * Whether to emit parse errors while parsing (default: `false`).
92520
+ *
92521
+ * > 👉 **Note**: parse errors are currently being added to HTML.
92522
+ * > Not all errors emitted by parse5 (or us) are specced yet.
92523
+ * > Some documentation may still be missing.
92524
+ */
92546
92525
 
92547
- const images_imageTransformer = () => tree => {
92548
- visit(tree, 'image', (image) => {
92549
- if (image.data?.hProperties?.className === 'border') {
92550
- image.data.hProperties.border = true;
92551
- }
92552
- });
92553
- };
92554
- /* harmony default export */ const migration_images = (images_imageTransformer);
92555
92526
 
92556
- ;// ./processor/migration/linkReference.ts
92557
92527
 
92558
- const linkReferenceTransformer = () => (tree) => {
92559
- visit(tree, 'linkReference', (node, index, parent) => {
92560
- const definitions = {};
92561
- visit(tree, 'definition', (def) => {
92562
- definitions[def.identifier] = def;
92563
- });
92564
- if (node.label === node.identifier && parent) {
92565
- if (!(node.identifier in definitions)) {
92566
- parent.children[index] = {
92567
- type: 'text',
92568
- value: `[${node.label}]`,
92569
- position: node.position,
92570
- };
92571
- }
92572
- }
92573
- });
92574
- return tree;
92575
- };
92576
- /* harmony default export */ const migration_linkReference = (linkReferenceTransformer);
92528
+ /**
92529
+ * Plugin to add support for parsing from HTML.
92530
+ *
92531
+ * > 👉 **Note**: this is not an XML parser.
92532
+ * > It supports SVG as embedded in HTML.
92533
+ * > It does not support the features available in XML.
92534
+ * > Passing SVG files might break but fragments of modern SVG should be fine.
92535
+ * > Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.
92536
+ *
92537
+ * @param {Options | null | undefined} [options]
92538
+ * Configuration (optional).
92539
+ * @returns {undefined}
92540
+ * Nothing.
92541
+ */
92542
+ function rehypeParse(options) {
92543
+ /** @type {Processor<Root>} */
92544
+ // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.
92545
+ const self = this
92546
+ const {emitParseErrors, ...settings} = {...self.data('settings'), ...options}
92577
92547
 
92578
- ;// ./processor/migration/table-cell.ts
92548
+ self.parser = parser
92579
92549
 
92580
- const magicIndex = (i, j) => `${i === 0 ? 'h' : `${i - 1}`}-${j}`;
92581
- const isInlineHtml = node => node.type === 'html' && !node.block;
92582
- // @note: This regex is detect malformed lists that were created by the
92583
- // markdown editor. Consider the following markdown:
92584
- //
92585
- // ```
92586
- // * item 1
92587
- // * item 2
92588
- // * item 3
92589
- // ```
92590
- //
92591
- // This is a perfectly valid list. But when you put that text into a table
92592
- // cell, the editor does **bad** things. After a save and load cycle, it gets
92593
- // converted to this:
92594
- //
92595
- // ```
92596
- // \_ item 1
92597
- // \_ item 2
92598
- // \* item 3
92599
- // ```
92600
- //
92601
- // The following regex attempts to detect this pattern, and we'll convert it to
92602
- // something more standard.
92603
- const psuedoListRegex = /^(?![ \t]*([*_]+).*\1[ \t]*$)(?<ws>[ \t]*)\\?([*_])\s*(?<item>.*)$/gm;
92604
- const migrateTableCells = (vfile, rdmd) => (table) => {
92605
- let json;
92606
- try {
92607
- const { position } = table;
92608
- if (position) {
92609
- json = JSON.parse(vfile
92610
- .toString()
92611
- .slice(position.start.offset, position.end.offset)
92612
- .replace(/.*\[block:parameters\](.*)\[\/block\].*/s, '$1'));
92613
- }
92614
- }
92615
- catch (err) {
92616
- /**
92617
- * This failure case is already handled by the following logic. Plus,
92618
- * because it's being handled internally, there's no way for our
92619
- * migration script to catch the error or keep track of it, and it just
92620
- * ends up blowing up the output logs.
92621
- */
92622
- // console.error(err);
92623
- }
92624
- visit(table, 'tableRow', (row, i) => {
92625
- visit(row, 'tableCell', (cell, j) => {
92626
- let children = cell.children;
92627
- if (json && json.data[magicIndex(i, j)]) {
92628
- const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
92629
- children = rdmd.mdast(string).children;
92550
+ /**
92551
+ * @type {Parser<Root>}
92552
+ */
92553
+ function parser(document, file) {
92554
+ return fromHtml(document, {
92555
+ ...settings,
92556
+ onerror: emitParseErrors
92557
+ ? function (message) {
92558
+ if (file.path) {
92559
+ message.name = file.path + ':' + message.name
92560
+ message.file = file.path
92630
92561
  }
92631
- cell.children =
92632
- children.length > 1 && !children.some(isInlineHtml)
92633
- ? children
92634
- : [{ type: 'paragraph', children }];
92635
- return SKIP;
92636
- });
92637
- return SKIP;
92638
- });
92639
- visit(table, 'inlineCode', (code) => {
92640
- if (code.value.includes('\n')) {
92641
- code.type = 'code';
92642
- }
92643
- });
92644
- };
92645
- function tableCellTransformer() {
92646
- const rdmd = this.data('rdmd');
92647
- return (tree, vfile) => {
92648
- visit(tree, 'table', migrateTableCells(vfile, rdmd));
92649
- return tree;
92650
- };
92651
- }
92652
- /* harmony default export */ const table_cell = (tableCellTransformer);
92653
92562
 
92654
- ;// ./processor/migration/index.ts
92655
-
92656
-
92657
-
92658
-
92659
- const transformers = [migration_emphasis, migration_images, migration_linkReference, table_cell];
92660
- /* harmony default export */ const migration = (transformers);
92661
-
92662
- ;// ./lib/mdastV6.ts
92663
-
92664
- const migrationNormalize = (doc) => {
92665
- return doc.replaceAll(/^(<!--.*?)\\-->$/gms, '$1-->');
92666
- };
92667
- const mdastV6 = (doc, { rdmd }) => {
92668
- const [_normalizedDoc] = rdmd.setup(doc);
92669
- const normalizedDoc = migrationNormalize(_normalizedDoc);
92670
- const proc = rdmd.processor().use(migration).data('rdmd', rdmd);
92671
- const tree = proc.parse(normalizedDoc);
92672
- proc.runSync(tree, normalizedDoc);
92673
- return tree;
92674
- };
92675
- /* harmony default export */ const lib_mdastV6 = (mdastV6);
92563
+ file.messages.push(message)
92564
+ }
92565
+ : undefined
92566
+ })
92567
+ }
92568
+ }
92676
92569
 
92677
92570
  ;// ./node_modules/hast-util-is-element/lib/index.js
92678
92571
  /**
@@ -97199,6 +97092,227 @@ function rehypeRemark(destination, options) {
97199
97092
  }
97200
97093
  }
97201
97094
 
97095
+ ;// ./lib/htmlToMarkdown.ts
97096
+
97097
+
97098
+
97099
+
97100
+
97101
+ /**
97102
+ * Converts an HTML fragment to GitHub-flavored Markdown.
97103
+ *
97104
+ * `remark-gfm` is load-bearing: without it, `<table>` and `<del>` input throws
97105
+ * at serialization. `iframe` (default: becomes a link) and `noscript` (default:
97106
+ * keeps its text) are dropped by the handlers so raw markup never leaks;
97107
+ * `script`, `style`, and `template` already drop by default and are overridden
97108
+ * defensively. HTML comments are dropped via `nodeHandlers`.
97109
+ */
97110
+ const processor = unified()
97111
+ .use(rehypeParse, { fragment: true })
97112
+ .use(rehypeRemark, {
97113
+ // A comment is a `comment` node, not an element, so it goes in
97114
+ // `nodeHandlers` rather than `handlers`.
97115
+ handlers: {
97116
+ iframe: () => undefined,
97117
+ noscript: () => undefined,
97118
+ script: () => undefined,
97119
+ style: () => undefined,
97120
+ template: () => undefined,
97121
+ },
97122
+ nodeHandlers: { comment: () => undefined },
97123
+ })
97124
+ .use(remarkGfm)
97125
+ .use(remarkStringify, { bullet: '-', emphasis: '_', fences: true });
97126
+ /**
97127
+ * Returns the Markdown form of `html`, or an empty string when there is no
97128
+ * usable input. Synchronous, so it can run inside non-async serializers.
97129
+ */
97130
+ function htmlToMarkdown(html) {
97131
+ if (typeof html !== 'string' || !html.trim())
97132
+ return '';
97133
+ return processor.processSync(html).toString().trim();
97134
+ }
97135
+
97136
+ ;// ./processor/migration/emphasis.ts
97137
+
97138
+ const emphasis_strongTest = (node) => ['emphasis', 'strong'].includes(node.type);
97139
+ const addSpaceBefore = (index, parent) => {
97140
+ if (!(index > 0 && parent.children[index - 1]))
97141
+ return;
97142
+ const prev = parent.children[index - 1];
97143
+ if (!('value' in prev) || prev.value.endsWith(' ') || prev.type === 'escape')
97144
+ return;
97145
+ parent.children.splice(index, 0, { type: 'text', value: ' ' });
97146
+ };
97147
+ const addSpaceAfter = (index, parent) => {
97148
+ if (!(index < parent.children.length - 1 && parent.children[index + 1]))
97149
+ return;
97150
+ const nextChild = parent.children[index + 1];
97151
+ if (!('value' in nextChild) || nextChild.value.startsWith(' '))
97152
+ return;
97153
+ parent.children.splice(index + 1, 0, { type: 'text', value: ' ' });
97154
+ };
97155
+ const trimEmphasis = (node, index, parent) => {
97156
+ let trimmed = false;
97157
+ visit(node, 'text', (child) => {
97158
+ const newValue = child.value.trimStart();
97159
+ if (newValue !== child.value) {
97160
+ trimmed = true;
97161
+ child.value = newValue;
97162
+ }
97163
+ return EXIT;
97164
+ });
97165
+ visit(node, 'text', (child) => {
97166
+ const newValue = child.value.trimEnd();
97167
+ if (newValue !== child.value) {
97168
+ trimmed = true;
97169
+ child.value = newValue;
97170
+ }
97171
+ return EXIT;
97172
+ }, true);
97173
+ if (trimmed) {
97174
+ addSpaceBefore(index, parent);
97175
+ addSpaceAfter(index, parent);
97176
+ }
97177
+ };
97178
+ const emphasisTransfomer = () => (tree) => {
97179
+ visit(tree, emphasis_strongTest, trimEmphasis);
97180
+ return tree;
97181
+ };
97182
+ /* harmony default export */ const migration_emphasis = (emphasisTransfomer);
97183
+
97184
+ ;// ./processor/migration/images.ts
97185
+
97186
+ const images_imageTransformer = () => tree => {
97187
+ visit(tree, 'image', (image) => {
97188
+ if (image.data?.hProperties?.className === 'border') {
97189
+ image.data.hProperties.border = true;
97190
+ }
97191
+ });
97192
+ };
97193
+ /* harmony default export */ const migration_images = (images_imageTransformer);
97194
+
97195
+ ;// ./processor/migration/linkReference.ts
97196
+
97197
+ const linkReferenceTransformer = () => (tree) => {
97198
+ visit(tree, 'linkReference', (node, index, parent) => {
97199
+ const definitions = {};
97200
+ visit(tree, 'definition', (def) => {
97201
+ definitions[def.identifier] = def;
97202
+ });
97203
+ if (node.label === node.identifier && parent) {
97204
+ if (!(node.identifier in definitions)) {
97205
+ parent.children[index] = {
97206
+ type: 'text',
97207
+ value: `[${node.label}]`,
97208
+ position: node.position,
97209
+ };
97210
+ }
97211
+ }
97212
+ });
97213
+ return tree;
97214
+ };
97215
+ /* harmony default export */ const migration_linkReference = (linkReferenceTransformer);
97216
+
97217
+ ;// ./processor/migration/table-cell.ts
97218
+
97219
+ const magicIndex = (i, j) => `${i === 0 ? 'h' : `${i - 1}`}-${j}`;
97220
+ const isInlineHtml = node => node.type === 'html' && !node.block;
97221
+ // @note: This regex is detect malformed lists that were created by the
97222
+ // markdown editor. Consider the following markdown:
97223
+ //
97224
+ // ```
97225
+ // * item 1
97226
+ // * item 2
97227
+ // * item 3
97228
+ // ```
97229
+ //
97230
+ // This is a perfectly valid list. But when you put that text into a table
97231
+ // cell, the editor does **bad** things. After a save and load cycle, it gets
97232
+ // converted to this:
97233
+ //
97234
+ // ```
97235
+ // \_ item 1
97236
+ // \_ item 2
97237
+ // \* item 3
97238
+ // ```
97239
+ //
97240
+ // The following regex attempts to detect this pattern, and we'll convert it to
97241
+ // something more standard.
97242
+ const psuedoListRegex = /^(?![ \t]*([*_]+).*\1[ \t]*$)(?<ws>[ \t]*)\\?([*_])\s*(?<item>.*)$/gm;
97243
+ const migrateTableCells = (vfile, rdmd) => (table) => {
97244
+ let json;
97245
+ try {
97246
+ const { position } = table;
97247
+ if (position) {
97248
+ json = JSON.parse(vfile
97249
+ .toString()
97250
+ .slice(position.start.offset, position.end.offset)
97251
+ .replace(/.*\[block:parameters\](.*)\[\/block\].*/s, '$1'));
97252
+ }
97253
+ }
97254
+ catch (err) {
97255
+ /**
97256
+ * This failure case is already handled by the following logic. Plus,
97257
+ * because it's being handled internally, there's no way for our
97258
+ * migration script to catch the error or keep track of it, and it just
97259
+ * ends up blowing up the output logs.
97260
+ */
97261
+ // console.error(err);
97262
+ }
97263
+ visit(table, 'tableRow', (row, i) => {
97264
+ visit(row, 'tableCell', (cell, j) => {
97265
+ let children = cell.children;
97266
+ if (json && json.data[magicIndex(i, j)]) {
97267
+ const string = json.data[magicIndex(i, j)].replace(psuedoListRegex, '$<ws>- $<item>');
97268
+ children = rdmd.mdast(string).children;
97269
+ }
97270
+ cell.children =
97271
+ children.length > 1 && !children.some(isInlineHtml)
97272
+ ? children
97273
+ : [{ type: 'paragraph', children }];
97274
+ return SKIP;
97275
+ });
97276
+ return SKIP;
97277
+ });
97278
+ visit(table, 'inlineCode', (code) => {
97279
+ if (code.value.includes('\n')) {
97280
+ code.type = 'code';
97281
+ }
97282
+ });
97283
+ };
97284
+ function tableCellTransformer() {
97285
+ const rdmd = this.data('rdmd');
97286
+ return (tree, vfile) => {
97287
+ visit(tree, 'table', migrateTableCells(vfile, rdmd));
97288
+ return tree;
97289
+ };
97290
+ }
97291
+ /* harmony default export */ const table_cell = (tableCellTransformer);
97292
+
97293
+ ;// ./processor/migration/index.ts
97294
+
97295
+
97296
+
97297
+
97298
+ const transformers = [migration_emphasis, migration_images, migration_linkReference, table_cell];
97299
+ /* harmony default export */ const migration = (transformers);
97300
+
97301
+ ;// ./lib/mdastV6.ts
97302
+
97303
+ const migrationNormalize = (doc) => {
97304
+ return doc.replaceAll(/^(<!--.*?)\\-->$/gms, '$1-->');
97305
+ };
97306
+ const mdastV6 = (doc, { rdmd }) => {
97307
+ const [_normalizedDoc] = rdmd.setup(doc);
97308
+ const normalizedDoc = migrationNormalize(_normalizedDoc);
97309
+ const proc = rdmd.processor().use(migration).data('rdmd', rdmd);
97310
+ const tree = proc.parse(normalizedDoc);
97311
+ proc.runSync(tree, normalizedDoc);
97312
+ return tree;
97313
+ };
97314
+ /* harmony default export */ const lib_mdastV6 = (mdastV6);
97315
+
97202
97316
  ;// ./processor/compile/anchor.ts
97203
97317
 
97204
97318
 
@@ -102517,6 +102631,7 @@ function mdxComponent() {
102517
102631
 
102518
102632
 
102519
102633
 
102634
+
102520
102635
 
102521
102636
 
102522
102637
  const buildInlineMdProcessor = (safeMode) => {
@@ -102524,7 +102639,7 @@ const buildInlineMdProcessor = (safeMode) => {
102524
102639
  // body (e.g. a `<Callout>`) is captured as one html node. Without it, blank
102525
102640
  // lines between rows let CommonMark HTML block type 6 fragment the table and
102526
102641
  // its rows spill out as text / indented code blocks (CX-3705).
102527
- const micromarkExts = [jsxTable(), mdxComponent(), syntax_gemoji(), legacyVariable(), magicBlock()];
102642
+ const micromarkExts = [disableIndentedCode, jsxTable(), mdxComponent(), syntax_gemoji(), legacyVariable(), magicBlock()];
102528
102643
  const fromMarkdownExts = [
102529
102644
  jsxTableFromMarkdown(),
102530
102645
  mdxComponentFromMarkdown(),
@@ -103835,71 +103950,6 @@ const generateSlugForHeadings = () => (tree) => {
103835
103950
  // EXTERNAL MODULE: external "@readme/variable"
103836
103951
  var variable_ = __webpack_require__(8167);
103837
103952
  var variable_default = /*#__PURE__*/__webpack_require__.n(variable_);
103838
- ;// ./node_modules/rehype-parse/lib/index.js
103839
- /**
103840
- * @import {Root} from 'hast'
103841
- * @import {Options as FromHtmlOptions} from 'hast-util-from-html'
103842
- * @import {Parser, Processor} from 'unified'
103843
- */
103844
-
103845
- /**
103846
- * @typedef {Omit<FromHtmlOptions, 'onerror'> & RehypeParseFields} Options
103847
- * Configuration.
103848
- *
103849
- * @typedef RehypeParseFields
103850
- * Extra fields.
103851
- * @property {boolean | null | undefined} [emitParseErrors=false]
103852
- * Whether to emit parse errors while parsing (default: `false`).
103853
- *
103854
- * > 👉 **Note**: parse errors are currently being added to HTML.
103855
- * > Not all errors emitted by parse5 (or us) are specced yet.
103856
- * > Some documentation may still be missing.
103857
- */
103858
-
103859
-
103860
-
103861
- /**
103862
- * Plugin to add support for parsing from HTML.
103863
- *
103864
- * > 👉 **Note**: this is not an XML parser.
103865
- * > It supports SVG as embedded in HTML.
103866
- * > It does not support the features available in XML.
103867
- * > Passing SVG files might break but fragments of modern SVG should be fine.
103868
- * > Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.
103869
- *
103870
- * @param {Options | null | undefined} [options]
103871
- * Configuration (optional).
103872
- * @returns {undefined}
103873
- * Nothing.
103874
- */
103875
- function rehypeParse(options) {
103876
- /** @type {Processor<Root>} */
103877
- // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.
103878
- const self = this
103879
- const {emitParseErrors, ...settings} = {...self.data('settings'), ...options}
103880
-
103881
- self.parser = parser
103882
-
103883
- /**
103884
- * @type {Parser<Root>}
103885
- */
103886
- function parser(document, file) {
103887
- return fromHtml(document, {
103888
- ...settings,
103889
- onerror: emitParseErrors
103890
- ? function (message) {
103891
- if (file.path) {
103892
- message.name = file.path + ':' + message.name
103893
- message.file = file.path
103894
- }
103895
-
103896
- file.messages.push(message)
103897
- }
103898
- : undefined
103899
- })
103900
- }
103901
- }
103902
-
103903
103953
  ;// ./lib/micromark/loose-html-entities/syntax.ts
103904
103954
 
103905
103955
 
@@ -106825,6 +106875,7 @@ function mdxishAstProcessor(mdContent, opts = {}) {
106825
106875
  // Parser extension for MDX expressions {}
106826
106876
  const mdxExprTextOnly = mdxExpressionLenient();
106827
106877
  const micromarkExts = [
106878
+ disableIndentedCode,
106828
106879
  jsxTable(),
106829
106880
  magicBlock(),
106830
106881
  mdxComponent(),
@@ -107609,6 +107660,7 @@ async function stripComments(doc, { mdx, mdxish } = {}) {
107609
107660
 
107610
107661
 
107611
107662
 
107663
+
107612
107664
  ;// ./index.tsx
107613
107665
 
107614
107666