@readme/markdown 13.6.2 → 13.6.3

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.
@@ -7,10 +7,10 @@ export interface MdastOpts {
7
7
  missingComponents?: 'ignore' | 'throw';
8
8
  remarkPlugins?: PluggableList;
9
9
  }
10
- export declare const remarkPlugins: (typeof remarkGfm | (() => (tree: import("mdast").Root) => void) | (({ copyButtons }?: {
11
- copyButtons?: boolean;
12
- }) => (tree: import("mdast").Node) => import("mdast").Node) | (({ isMdxish }?: {
10
+ export declare const remarkPlugins: (typeof remarkGfm | (({ isMdxish }?: {
13
11
  isMdxish?: boolean;
12
+ }) => (tree: import("mdast").Root) => void) | (({ copyButtons }?: {
13
+ copyButtons?: boolean;
14
14
  }) => (tree: import("mdast").Node) => import("mdast").Node) | typeof remarkFrontmatter)[];
15
15
  export declare const rehypePlugins: (typeof rehypeSlug | (() => (tree: import("unist").Node) => import("unist").Node))[];
16
16
  declare const astProcessor: (opts?: MdastOpts) => import("unified").Processor<import("mdast").Root, import("mdast").Root, import("mdast").Root, import("mdast").Root, string>;
package/dist/main.js CHANGED
@@ -32830,13 +32830,9 @@ function listItemWithTaskListItem(node, parent, state, info) {
32830
32830
 
32831
32831
  ;// ./node_modules/mdast-util-gfm/lib/index.js
32832
32832
  /**
32833
- * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
32834
- * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
32835
- */
32836
-
32837
- /**
32838
- * @typedef {import('mdast-util-gfm-table').Options} Options
32839
- * Configuration.
32833
+ * @import {Extension as FromMarkdownExtension} from 'mdast-util-from-markdown'
32834
+ * @import {Options} from 'mdast-util-gfm'
32835
+ * @import {Options as ToMarkdownExtension} from 'mdast-util-to-markdown'
32840
32836
  */
32841
32837
 
32842
32838
 
@@ -32868,7 +32864,7 @@ function gfmFromMarkdown() {
32868
32864
  * literals, footnotes, strikethrough, tables, tasklists).
32869
32865
  *
32870
32866
  * @param {Options | null | undefined} [options]
32871
- * Configuration.
32867
+ * Configuration (optional).
32872
32868
  * @returns {ToMarkdownExtension}
32873
32869
  * Extension for `mdast-util-to-markdown` to enable GFM (autolink literals,
32874
32870
  * footnotes, strikethrough, tables, tasklists).
@@ -32877,7 +32873,7 @@ function gfmToMarkdown(options) {
32877
32873
  return {
32878
32874
  extensions: [
32879
32875
  gfmAutolinkLiteralToMarkdown(),
32880
- gfmFootnoteToMarkdown(),
32876
+ gfmFootnoteToMarkdown(options),
32881
32877
  gfmStrikethroughToMarkdown(),
32882
32878
  gfmTableToMarkdown(options),
32883
32879
  gfmTaskListItemToMarkdown()
@@ -53081,7 +53077,7 @@ const titleParser = unified().use(remarkParse).use(remarkGfm);
53081
53077
  // The title paragraph may contain custom AST nodes that `toMarkdown` doesn't
53082
53078
  // natively understand
53083
53079
  const toMarkdownExtensions = [
53084
- gfmStrikethroughToMarkdown(),
53080
+ gfmToMarkdown(),
53085
53081
  // For mdx variable syntaxes (e.g., {user.name})
53086
53082
  mdxExpressionToMarkdown(),
53087
53083
  // Important: This is required and would crash the parser if there's no variable node handler
@@ -53173,7 +53169,7 @@ const removeIconPrefix = (paragraph, prefixLength) => {
53173
53169
  firstTextNode.value = firstTextNode.value.slice(prefixLength);
53174
53170
  }
53175
53171
  };
53176
- const processBlockquote = (node, index, parent) => {
53172
+ const processBlockquote = (node, index, parent, isMdxish = false) => {
53177
53173
  if (!isCalloutStructure(node)) {
53178
53174
  // Only stringify empty blockquotes (no extractable text content)
53179
53175
  // Preserve blockquotes with actual content (e.g., headings, lists, etc.)
@@ -53221,7 +53217,11 @@ const processBlockquote = (node, index, parent) => {
53221
53217
  node.children[0].position.start.offset += match.length;
53222
53218
  node.children[0].position.start.column += match.length;
53223
53219
  }
53224
- else {
53220
+ else if (isMdxish) {
53221
+ // Block-level title re-parsing is only needed for MDXish where HTML stays
53222
+ // as raw nodes. In MDX, remarkMdx has already converted HTML to JSX AST
53223
+ // nodes which toMarkdown can't serialize — and MDX doesn't need this
53224
+ // block-level title handling anyway.
53225
53225
  const headingText = toMarkdown({ type: 'root', children: [firstParagraph] }, {
53226
53226
  extensions: toMarkdownExtensions,
53227
53227
  })
@@ -53247,6 +53247,11 @@ const processBlockquote = (node, index, parent) => {
53247
53247
  node.children[0].position.start.column += match.length;
53248
53248
  }
53249
53249
  }
53250
+ else {
53251
+ node.children[0] = wrapHeading(node);
53252
+ node.children[0].position.start.offset += match.length;
53253
+ node.children[0].position.start.column += match.length;
53254
+ }
53250
53255
  }
53251
53256
  // Insert body content as a separate paragraph after the heading
53252
53257
  if (bodyChildren) {
@@ -53277,10 +53282,10 @@ const processBlockquote = (node, index, parent) => {
53277
53282
  });
53278
53283
  }
53279
53284
  };
53280
- const calloutTransformer = () => {
53285
+ const calloutTransformer = ({ isMdxish = false } = {}) => {
53281
53286
  const processNode = (root) => {
53282
53287
  visit(root, 'blockquote', (node, index, parent) => {
53283
- processBlockquote(node, index, parent);
53288
+ processBlockquote(node, index, parent, isMdxish);
53284
53289
  if (node.type === NodeTypes.callout) {
53285
53290
  // SKIP prevents re-processing synthetic blockquotes in parsed title content
53286
53291
  // (e.g., blockquotes from "> Quote" titles). Recursively process body children
@@ -71273,7 +71278,7 @@ const tableNodeProcessor = unified()
71273
71278
  .use(remarkParse)
71274
71279
  .use(remarkMdx)
71275
71280
  .use(normalize_malformed_md_syntax)
71276
- .use([callouts, gemoji_, code_tabs])
71281
+ .use([[callouts, { isMdxish: true }], gemoji_, code_tabs])
71277
71282
  .use(remarkGfm);
71278
71283
  /**
71279
71284
  * Check if children are only text nodes that might contain markdown
@@ -72142,7 +72147,12 @@ const defaultTransforms = {
72142
72147
  imageTransformer: transform_images,
72143
72148
  gemojiTransformer: gemoji_,
72144
72149
  };
72145
- const mdxishTransformers = [callouts, code_tabs, transform_images, gemoji_];
72150
+ const mdxishTransformers = [
72151
+ [callouts, { isMdxish: true }],
72152
+ code_tabs,
72153
+ transform_images,
72154
+ gemoji_,
72155
+ ];
72146
72156
  /* harmony default export */ const transform = (Object.values(defaultTransforms));
72147
72157
 
72148
72158
  ;// ./lib/ast-processor.ts
@@ -98974,7 +98984,12 @@ function loadComponents() {
98974
98984
 
98975
98985
 
98976
98986
 
98977
- const defaultTransformers = [callouts, code_tabs, gemoji_, transform_embeds];
98987
+ const defaultTransformers = [
98988
+ [callouts, { isMdxish: true }],
98989
+ code_tabs,
98990
+ gemoji_,
98991
+ transform_embeds,
98992
+ ];
98978
98993
  /**
98979
98994
  * Preprocessing pipeline: applies string-level transformations to work around
98980
98995
  * CommonMark/remark limitations and reach parity with legacy (rdmd) rendering.
@@ -99021,8 +99036,21 @@ function mdxishAstProcessor(mdContent, opts = {}) {
99021
99036
  ? [jsxTable(), magicBlock(), legacyVariable(), looseHtmlEntity()]
99022
99037
  : [jsxTable(), magicBlock(), mdxExprTextOnly, legacyVariable(), looseHtmlEntity()])
99023
99038
  .data('fromMarkdownExtensions', safeMode
99024
- ? [jsxTableFromMarkdown(), magicBlockFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()]
99025
- : [jsxTableFromMarkdown(), magicBlockFromMarkdown(), mdxExpressionFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()])
99039
+ ? [
99040
+ jsxTableFromMarkdown(),
99041
+ magicBlockFromMarkdown(),
99042
+ legacyVariableFromMarkdown(),
99043
+ emptyTaskListItemFromMarkdown(),
99044
+ looseHtmlEntityFromMarkdown(),
99045
+ ]
99046
+ : [
99047
+ jsxTableFromMarkdown(),
99048
+ magicBlockFromMarkdown(),
99049
+ mdxExpressionFromMarkdown(),
99050
+ legacyVariableFromMarkdown(),
99051
+ emptyTaskListItemFromMarkdown(),
99052
+ looseHtmlEntityFromMarkdown(),
99053
+ ])
99026
99054
  .use(remarkParse)
99027
99055
  .use(remarkFrontmatter)
99028
99056
  .use(normalize_malformed_md_syntax)
package/dist/main.node.js CHANGED
@@ -46998,13 +46998,9 @@ function listItemWithTaskListItem(node, parent, state, info) {
46998
46998
 
46999
46999
  ;// ./node_modules/mdast-util-gfm/lib/index.js
47000
47000
  /**
47001
- * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
47002
- * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
47003
- */
47004
-
47005
- /**
47006
- * @typedef {import('mdast-util-gfm-table').Options} Options
47007
- * Configuration.
47001
+ * @import {Extension as FromMarkdownExtension} from 'mdast-util-from-markdown'
47002
+ * @import {Options} from 'mdast-util-gfm'
47003
+ * @import {Options as ToMarkdownExtension} from 'mdast-util-to-markdown'
47008
47004
  */
47009
47005
 
47010
47006
 
@@ -47036,7 +47032,7 @@ function gfmFromMarkdown() {
47036
47032
  * literals, footnotes, strikethrough, tables, tasklists).
47037
47033
  *
47038
47034
  * @param {Options | null | undefined} [options]
47039
- * Configuration.
47035
+ * Configuration (optional).
47040
47036
  * @returns {ToMarkdownExtension}
47041
47037
  * Extension for `mdast-util-to-markdown` to enable GFM (autolink literals,
47042
47038
  * footnotes, strikethrough, tables, tasklists).
@@ -47045,7 +47041,7 @@ function gfmToMarkdown(options) {
47045
47041
  return {
47046
47042
  extensions: [
47047
47043
  gfmAutolinkLiteralToMarkdown(),
47048
- gfmFootnoteToMarkdown(),
47044
+ gfmFootnoteToMarkdown(options),
47049
47045
  gfmStrikethroughToMarkdown(),
47050
47046
  gfmTableToMarkdown(options),
47051
47047
  gfmTaskListItemToMarkdown()
@@ -73285,7 +73281,7 @@ const titleParser = unified().use(remarkParse).use(remarkGfm);
73285
73281
  // The title paragraph may contain custom AST nodes that `toMarkdown` doesn't
73286
73282
  // natively understand
73287
73283
  const toMarkdownExtensions = [
73288
- gfmStrikethroughToMarkdown(),
73284
+ gfmToMarkdown(),
73289
73285
  // For mdx variable syntaxes (e.g., {user.name})
73290
73286
  mdxExpressionToMarkdown(),
73291
73287
  // Important: This is required and would crash the parser if there's no variable node handler
@@ -73377,7 +73373,7 @@ const removeIconPrefix = (paragraph, prefixLength) => {
73377
73373
  firstTextNode.value = firstTextNode.value.slice(prefixLength);
73378
73374
  }
73379
73375
  };
73380
- const processBlockquote = (node, index, parent) => {
73376
+ const processBlockquote = (node, index, parent, isMdxish = false) => {
73381
73377
  if (!isCalloutStructure(node)) {
73382
73378
  // Only stringify empty blockquotes (no extractable text content)
73383
73379
  // Preserve blockquotes with actual content (e.g., headings, lists, etc.)
@@ -73425,7 +73421,11 @@ const processBlockquote = (node, index, parent) => {
73425
73421
  node.children[0].position.start.offset += match.length;
73426
73422
  node.children[0].position.start.column += match.length;
73427
73423
  }
73428
- else {
73424
+ else if (isMdxish) {
73425
+ // Block-level title re-parsing is only needed for MDXish where HTML stays
73426
+ // as raw nodes. In MDX, remarkMdx has already converted HTML to JSX AST
73427
+ // nodes which toMarkdown can't serialize — and MDX doesn't need this
73428
+ // block-level title handling anyway.
73429
73429
  const headingText = toMarkdown({ type: 'root', children: [firstParagraph] }, {
73430
73430
  extensions: toMarkdownExtensions,
73431
73431
  })
@@ -73451,6 +73451,11 @@ const processBlockquote = (node, index, parent) => {
73451
73451
  node.children[0].position.start.column += match.length;
73452
73452
  }
73453
73453
  }
73454
+ else {
73455
+ node.children[0] = wrapHeading(node);
73456
+ node.children[0].position.start.offset += match.length;
73457
+ node.children[0].position.start.column += match.length;
73458
+ }
73454
73459
  }
73455
73460
  // Insert body content as a separate paragraph after the heading
73456
73461
  if (bodyChildren) {
@@ -73481,10 +73486,10 @@ const processBlockquote = (node, index, parent) => {
73481
73486
  });
73482
73487
  }
73483
73488
  };
73484
- const calloutTransformer = () => {
73489
+ const calloutTransformer = ({ isMdxish = false } = {}) => {
73485
73490
  const processNode = (root) => {
73486
73491
  visit(root, 'blockquote', (node, index, parent) => {
73487
- processBlockquote(node, index, parent);
73492
+ processBlockquote(node, index, parent, isMdxish);
73488
73493
  if (node.type === NodeTypes.callout) {
73489
73494
  // SKIP prevents re-processing synthetic blockquotes in parsed title content
73490
73495
  // (e.g., blockquotes from "> Quote" titles). Recursively process body children
@@ -91477,7 +91482,7 @@ const tableNodeProcessor = unified()
91477
91482
  .use(remarkParse)
91478
91483
  .use(remarkMdx)
91479
91484
  .use(normalize_malformed_md_syntax)
91480
- .use([callouts, gemoji_, code_tabs])
91485
+ .use([[callouts, { isMdxish: true }], gemoji_, code_tabs])
91481
91486
  .use(remarkGfm);
91482
91487
  /**
91483
91488
  * Check if children are only text nodes that might contain markdown
@@ -92346,7 +92351,12 @@ const defaultTransforms = {
92346
92351
  imageTransformer: transform_images,
92347
92352
  gemojiTransformer: gemoji_,
92348
92353
  };
92349
- const mdxishTransformers = [callouts, code_tabs, transform_images, gemoji_];
92354
+ const mdxishTransformers = [
92355
+ [callouts, { isMdxish: true }],
92356
+ code_tabs,
92357
+ transform_images,
92358
+ gemoji_,
92359
+ ];
92350
92360
  /* harmony default export */ const transform = (Object.values(defaultTransforms));
92351
92361
 
92352
92362
  ;// ./lib/ast-processor.ts
@@ -119178,7 +119188,12 @@ function loadComponents() {
119178
119188
 
119179
119189
 
119180
119190
 
119181
- const defaultTransformers = [callouts, code_tabs, gemoji_, transform_embeds];
119191
+ const defaultTransformers = [
119192
+ [callouts, { isMdxish: true }],
119193
+ code_tabs,
119194
+ gemoji_,
119195
+ transform_embeds,
119196
+ ];
119182
119197
  /**
119183
119198
  * Preprocessing pipeline: applies string-level transformations to work around
119184
119199
  * CommonMark/remark limitations and reach parity with legacy (rdmd) rendering.
@@ -119225,8 +119240,21 @@ function mdxishAstProcessor(mdContent, opts = {}) {
119225
119240
  ? [jsxTable(), magicBlock(), legacyVariable(), looseHtmlEntity()]
119226
119241
  : [jsxTable(), magicBlock(), mdxExprTextOnly, legacyVariable(), looseHtmlEntity()])
119227
119242
  .data('fromMarkdownExtensions', safeMode
119228
- ? [jsxTableFromMarkdown(), magicBlockFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()]
119229
- : [jsxTableFromMarkdown(), magicBlockFromMarkdown(), mdxExpressionFromMarkdown(), legacyVariableFromMarkdown(), emptyTaskListItemFromMarkdown(), looseHtmlEntityFromMarkdown()])
119243
+ ? [
119244
+ jsxTableFromMarkdown(),
119245
+ magicBlockFromMarkdown(),
119246
+ legacyVariableFromMarkdown(),
119247
+ emptyTaskListItemFromMarkdown(),
119248
+ looseHtmlEntityFromMarkdown(),
119249
+ ]
119250
+ : [
119251
+ jsxTableFromMarkdown(),
119252
+ magicBlockFromMarkdown(),
119253
+ mdxExpressionFromMarkdown(),
119254
+ legacyVariableFromMarkdown(),
119255
+ emptyTaskListItemFromMarkdown(),
119256
+ looseHtmlEntityFromMarkdown(),
119257
+ ])
119230
119258
  .use(remarkParse)
119231
119259
  .use(remarkFrontmatter)
119232
119260
  .use(normalize_malformed_md_syntax)