@readme/markdown 13.6.1 → 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.
- package/dist/lib/ast-processor.d.ts +3 -3
- package/dist/lib/plain.d.ts +7 -0
- package/dist/main.js +76 -21
- package/dist/main.node.js +76 -21
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/callouts.d.ts +3 -1
- package/dist/processor/transform/index.d.ts +12 -4
- package/package.json +2 -1
|
@@ -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 | ((
|
|
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/lib/plain.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ interface Options {
|
|
|
9
9
|
* their respective regexes.
|
|
10
10
|
*/
|
|
11
11
|
preserveVariableSyntax?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Separator to use when joining sibling nodes.
|
|
14
|
+
* Defaults to a space for document-level plain text extraction.
|
|
15
|
+
* Use an empty string for inline-only contexts like TOC labels, where
|
|
16
|
+
* adjacent inline siblings should preserve authored adjacency.
|
|
17
|
+
*/
|
|
18
|
+
separator?: string;
|
|
12
19
|
variables?: Record<string, string>;
|
|
13
20
|
}
|
|
14
21
|
declare const plain: (node: Nodes, opts?: Options) => string | number | true | (string | number)[];
|
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
|
-
* @
|
|
32834
|
-
* @
|
|
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()
|
|
@@ -53015,11 +53011,12 @@ function plain_one(node, opts) {
|
|
|
53015
53011
|
function plain_all(node, opts) {
|
|
53016
53012
|
let index = -1;
|
|
53017
53013
|
const result = [];
|
|
53014
|
+
const separator = opts.separator ?? ' ';
|
|
53018
53015
|
// eslint-disable-next-line no-plusplus
|
|
53019
53016
|
while (++index < node?.children.length) {
|
|
53020
53017
|
result[index] = plain_one(node.children[index], opts);
|
|
53021
53018
|
}
|
|
53022
|
-
return result.join(
|
|
53019
|
+
return result.join(separator).replaceAll(/\s+/g, ' ').trim();
|
|
53023
53020
|
}
|
|
53024
53021
|
const plain = (node, opts = {}) => {
|
|
53025
53022
|
return 'children' in node ? plain_all(node, opts) || plain_one(node, opts) : plain_one(node, opts);
|
|
@@ -53080,7 +53077,7 @@ const titleParser = unified().use(remarkParse).use(remarkGfm);
|
|
|
53080
53077
|
// The title paragraph may contain custom AST nodes that `toMarkdown` doesn't
|
|
53081
53078
|
// natively understand
|
|
53082
53079
|
const toMarkdownExtensions = [
|
|
53083
|
-
|
|
53080
|
+
gfmToMarkdown(),
|
|
53084
53081
|
// For mdx variable syntaxes (e.g., {user.name})
|
|
53085
53082
|
mdxExpressionToMarkdown(),
|
|
53086
53083
|
// Important: This is required and would crash the parser if there's no variable node handler
|
|
@@ -53172,7 +53169,7 @@ const removeIconPrefix = (paragraph, prefixLength) => {
|
|
|
53172
53169
|
firstTextNode.value = firstTextNode.value.slice(prefixLength);
|
|
53173
53170
|
}
|
|
53174
53171
|
};
|
|
53175
|
-
const processBlockquote = (node, index, parent) => {
|
|
53172
|
+
const processBlockquote = (node, index, parent, isMdxish = false) => {
|
|
53176
53173
|
if (!isCalloutStructure(node)) {
|
|
53177
53174
|
// Only stringify empty blockquotes (no extractable text content)
|
|
53178
53175
|
// Preserve blockquotes with actual content (e.g., headings, lists, etc.)
|
|
@@ -53220,7 +53217,11 @@ const processBlockquote = (node, index, parent) => {
|
|
|
53220
53217
|
node.children[0].position.start.offset += match.length;
|
|
53221
53218
|
node.children[0].position.start.column += match.length;
|
|
53222
53219
|
}
|
|
53223
|
-
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.
|
|
53224
53225
|
const headingText = toMarkdown({ type: 'root', children: [firstParagraph] }, {
|
|
53225
53226
|
extensions: toMarkdownExtensions,
|
|
53226
53227
|
})
|
|
@@ -53246,6 +53247,11 @@ const processBlockquote = (node, index, parent) => {
|
|
|
53246
53247
|
node.children[0].position.start.column += match.length;
|
|
53247
53248
|
}
|
|
53248
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
|
+
}
|
|
53249
53255
|
}
|
|
53250
53256
|
// Insert body content as a separate paragraph after the heading
|
|
53251
53257
|
if (bodyChildren) {
|
|
@@ -53276,10 +53282,10 @@ const processBlockquote = (node, index, parent) => {
|
|
|
53276
53282
|
});
|
|
53277
53283
|
}
|
|
53278
53284
|
};
|
|
53279
|
-
const calloutTransformer = () => {
|
|
53285
|
+
const calloutTransformer = ({ isMdxish = false } = {}) => {
|
|
53280
53286
|
const processNode = (root) => {
|
|
53281
53287
|
visit(root, 'blockquote', (node, index, parent) => {
|
|
53282
|
-
processBlockquote(node, index, parent);
|
|
53288
|
+
processBlockquote(node, index, parent, isMdxish);
|
|
53283
53289
|
if (node.type === NodeTypes.callout) {
|
|
53284
53290
|
// SKIP prevents re-processing synthetic blockquotes in parsed title content
|
|
53285
53291
|
// (e.g., blockquotes from "> Quote" titles). Recursively process body children
|
|
@@ -71261,6 +71267,7 @@ const normalizeEmphasisAST = () => (tree) => {
|
|
|
71261
71267
|
|
|
71262
71268
|
|
|
71263
71269
|
|
|
71270
|
+
|
|
71264
71271
|
const isTableCell = (node) => isMDXElement(node) && ['th', 'td'].includes(node.name);
|
|
71265
71272
|
const tableTypes = {
|
|
71266
71273
|
tr: 'tableRow',
|
|
@@ -71271,7 +71278,7 @@ const tableNodeProcessor = unified()
|
|
|
71271
71278
|
.use(remarkParse)
|
|
71272
71279
|
.use(remarkMdx)
|
|
71273
71280
|
.use(normalize_malformed_md_syntax)
|
|
71274
|
-
.use([callouts, gemoji_])
|
|
71281
|
+
.use([[callouts, { isMdxish: true }], gemoji_, code_tabs])
|
|
71275
71282
|
.use(remarkGfm);
|
|
71276
71283
|
/**
|
|
71277
71284
|
* Check if children are only text nodes that might contain markdown
|
|
@@ -72140,7 +72147,12 @@ const defaultTransforms = {
|
|
|
72140
72147
|
imageTransformer: transform_images,
|
|
72141
72148
|
gemojiTransformer: gemoji_,
|
|
72142
72149
|
};
|
|
72143
|
-
const mdxishTransformers = [
|
|
72150
|
+
const mdxishTransformers = [
|
|
72151
|
+
[callouts, { isMdxish: true }],
|
|
72152
|
+
code_tabs,
|
|
72153
|
+
transform_images,
|
|
72154
|
+
gemoji_,
|
|
72155
|
+
];
|
|
72144
72156
|
/* harmony default export */ const transform = (Object.values(defaultTransforms));
|
|
72145
72157
|
|
|
72146
72158
|
;// ./lib/ast-processor.ts
|
|
@@ -86943,7 +86955,7 @@ const tocToHast = (headings = [], variables) => {
|
|
|
86943
86955
|
stack.pop();
|
|
86944
86956
|
}
|
|
86945
86957
|
if (heading.properties) {
|
|
86946
|
-
const content = lib_plain({ type: 'root', children: heading.children }, { variables: flatVars });
|
|
86958
|
+
const content = lib_plain({ type: 'root', children: heading.children }, { separator: '', variables: flatVars });
|
|
86947
86959
|
stack[stack.length - 1].children.push(hastscript_lib_h('li', null, hastscript_lib_h('a', { href: `#${heading.properties.id}` }, content)));
|
|
86948
86960
|
}
|
|
86949
86961
|
});
|
|
@@ -93754,6 +93766,14 @@ const rehypeMdxishComponents = ({ components, processMarkdown }) => {
|
|
|
93754
93766
|
visit(tree, 'element', (node, index, parent) => {
|
|
93755
93767
|
if (index === undefined || !parent)
|
|
93756
93768
|
return;
|
|
93769
|
+
// Parse Image caption as markdown so it renders formatted (bold, code,
|
|
93770
|
+
// decoded entities) in the figcaption instead of as a raw string.
|
|
93771
|
+
// rehypeRaw strips children from <img> (void element), so we must
|
|
93772
|
+
// re-process the caption here, after rehypeRaw.
|
|
93773
|
+
if (node.tagName === 'img' && typeof node.properties?.caption === 'string' && !node.children?.length) {
|
|
93774
|
+
const captionHast = processMarkdown(node.properties.caption);
|
|
93775
|
+
node.children = (captionHast.children ?? []).filter(isElementContentNode);
|
|
93776
|
+
}
|
|
93757
93777
|
// Skip runtime components and standard HTML tags
|
|
93758
93778
|
if (RUNTIME_COMPONENT_TAGS.has(node.tagName))
|
|
93759
93779
|
return;
|
|
@@ -95816,6 +95836,21 @@ const stripClosingTagFromParagraph = (node, tag) => {
|
|
|
95816
95836
|
if (closingIndex === -1)
|
|
95817
95837
|
return { paragraph: node, found: false };
|
|
95818
95838
|
children.splice(closingIndex, 1);
|
|
95839
|
+
// After removing the closing tag, trim trailing whitespace/newlines from the
|
|
95840
|
+
// preceding text node. Remark parses "Hello\n</Callout>" as text("Hello\n") +
|
|
95841
|
+
// html("</Callout>"), and the leftover \n would be converted to <br> in HAST.
|
|
95842
|
+
if (closingIndex > 0) {
|
|
95843
|
+
const prev = children[closingIndex - 1];
|
|
95844
|
+
if (prev.type === 'text') {
|
|
95845
|
+
const trimmed = prev.value.trimEnd();
|
|
95846
|
+
if (trimmed) {
|
|
95847
|
+
prev.value = trimmed;
|
|
95848
|
+
}
|
|
95849
|
+
else {
|
|
95850
|
+
children.splice(closingIndex - 1, 1);
|
|
95851
|
+
}
|
|
95852
|
+
}
|
|
95853
|
+
}
|
|
95819
95854
|
return { paragraph: { ...node, children }, found: true };
|
|
95820
95855
|
};
|
|
95821
95856
|
/**
|
|
@@ -96428,6 +96463,7 @@ const mdxishInlineComponents = () => tree => {
|
|
|
96428
96463
|
|
|
96429
96464
|
|
|
96430
96465
|
|
|
96466
|
+
|
|
96431
96467
|
const transformAnchor = (jsx) => {
|
|
96432
96468
|
const attrs = getAttrs(jsx);
|
|
96433
96469
|
const { href = '', label, target, title } = attrs;
|
|
@@ -96467,6 +96503,7 @@ const transformImage = (jsx) => {
|
|
|
96467
96503
|
alt,
|
|
96468
96504
|
border: border !== undefined ? String(border) : undefined,
|
|
96469
96505
|
caption,
|
|
96506
|
+
children: caption ? lib_mdast(caption).children : [],
|
|
96470
96507
|
className,
|
|
96471
96508
|
height: height !== undefined ? String(height) : undefined,
|
|
96472
96509
|
lazy,
|
|
@@ -98947,7 +98984,12 @@ function loadComponents() {
|
|
|
98947
98984
|
|
|
98948
98985
|
|
|
98949
98986
|
|
|
98950
|
-
const defaultTransformers = [
|
|
98987
|
+
const defaultTransformers = [
|
|
98988
|
+
[callouts, { isMdxish: true }],
|
|
98989
|
+
code_tabs,
|
|
98990
|
+
gemoji_,
|
|
98991
|
+
transform_embeds,
|
|
98992
|
+
];
|
|
98951
98993
|
/**
|
|
98952
98994
|
* Preprocessing pipeline: applies string-level transformations to work around
|
|
98953
98995
|
* CommonMark/remark limitations and reach parity with legacy (rdmd) rendering.
|
|
@@ -98994,8 +99036,21 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
98994
99036
|
? [jsxTable(), magicBlock(), legacyVariable(), looseHtmlEntity()]
|
|
98995
99037
|
: [jsxTable(), magicBlock(), mdxExprTextOnly, legacyVariable(), looseHtmlEntity()])
|
|
98996
99038
|
.data('fromMarkdownExtensions', safeMode
|
|
98997
|
-
? [
|
|
98998
|
-
|
|
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
|
+
])
|
|
98999
99054
|
.use(remarkParse)
|
|
99000
99055
|
.use(remarkFrontmatter)
|
|
99001
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
|
-
* @
|
|
47002
|
-
* @
|
|
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()
|
|
@@ -73219,11 +73215,12 @@ function plain_one(node, opts) {
|
|
|
73219
73215
|
function plain_all(node, opts) {
|
|
73220
73216
|
let index = -1;
|
|
73221
73217
|
const result = [];
|
|
73218
|
+
const separator = opts.separator ?? ' ';
|
|
73222
73219
|
// eslint-disable-next-line no-plusplus
|
|
73223
73220
|
while (++index < node?.children.length) {
|
|
73224
73221
|
result[index] = plain_one(node.children[index], opts);
|
|
73225
73222
|
}
|
|
73226
|
-
return result.join(
|
|
73223
|
+
return result.join(separator).replaceAll(/\s+/g, ' ').trim();
|
|
73227
73224
|
}
|
|
73228
73225
|
const plain = (node, opts = {}) => {
|
|
73229
73226
|
return 'children' in node ? plain_all(node, opts) || plain_one(node, opts) : plain_one(node, opts);
|
|
@@ -73284,7 +73281,7 @@ const titleParser = unified().use(remarkParse).use(remarkGfm);
|
|
|
73284
73281
|
// The title paragraph may contain custom AST nodes that `toMarkdown` doesn't
|
|
73285
73282
|
// natively understand
|
|
73286
73283
|
const toMarkdownExtensions = [
|
|
73287
|
-
|
|
73284
|
+
gfmToMarkdown(),
|
|
73288
73285
|
// For mdx variable syntaxes (e.g., {user.name})
|
|
73289
73286
|
mdxExpressionToMarkdown(),
|
|
73290
73287
|
// Important: This is required and would crash the parser if there's no variable node handler
|
|
@@ -73376,7 +73373,7 @@ const removeIconPrefix = (paragraph, prefixLength) => {
|
|
|
73376
73373
|
firstTextNode.value = firstTextNode.value.slice(prefixLength);
|
|
73377
73374
|
}
|
|
73378
73375
|
};
|
|
73379
|
-
const processBlockquote = (node, index, parent) => {
|
|
73376
|
+
const processBlockquote = (node, index, parent, isMdxish = false) => {
|
|
73380
73377
|
if (!isCalloutStructure(node)) {
|
|
73381
73378
|
// Only stringify empty blockquotes (no extractable text content)
|
|
73382
73379
|
// Preserve blockquotes with actual content (e.g., headings, lists, etc.)
|
|
@@ -73424,7 +73421,11 @@ const processBlockquote = (node, index, parent) => {
|
|
|
73424
73421
|
node.children[0].position.start.offset += match.length;
|
|
73425
73422
|
node.children[0].position.start.column += match.length;
|
|
73426
73423
|
}
|
|
73427
|
-
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.
|
|
73428
73429
|
const headingText = toMarkdown({ type: 'root', children: [firstParagraph] }, {
|
|
73429
73430
|
extensions: toMarkdownExtensions,
|
|
73430
73431
|
})
|
|
@@ -73450,6 +73451,11 @@ const processBlockquote = (node, index, parent) => {
|
|
|
73450
73451
|
node.children[0].position.start.column += match.length;
|
|
73451
73452
|
}
|
|
73452
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
|
+
}
|
|
73453
73459
|
}
|
|
73454
73460
|
// Insert body content as a separate paragraph after the heading
|
|
73455
73461
|
if (bodyChildren) {
|
|
@@ -73480,10 +73486,10 @@ const processBlockquote = (node, index, parent) => {
|
|
|
73480
73486
|
});
|
|
73481
73487
|
}
|
|
73482
73488
|
};
|
|
73483
|
-
const calloutTransformer = () => {
|
|
73489
|
+
const calloutTransformer = ({ isMdxish = false } = {}) => {
|
|
73484
73490
|
const processNode = (root) => {
|
|
73485
73491
|
visit(root, 'blockquote', (node, index, parent) => {
|
|
73486
|
-
processBlockquote(node, index, parent);
|
|
73492
|
+
processBlockquote(node, index, parent, isMdxish);
|
|
73487
73493
|
if (node.type === NodeTypes.callout) {
|
|
73488
73494
|
// SKIP prevents re-processing synthetic blockquotes in parsed title content
|
|
73489
73495
|
// (e.g., blockquotes from "> Quote" titles). Recursively process body children
|
|
@@ -91465,6 +91471,7 @@ const normalizeEmphasisAST = () => (tree) => {
|
|
|
91465
91471
|
|
|
91466
91472
|
|
|
91467
91473
|
|
|
91474
|
+
|
|
91468
91475
|
const isTableCell = (node) => isMDXElement(node) && ['th', 'td'].includes(node.name);
|
|
91469
91476
|
const tableTypes = {
|
|
91470
91477
|
tr: 'tableRow',
|
|
@@ -91475,7 +91482,7 @@ const tableNodeProcessor = unified()
|
|
|
91475
91482
|
.use(remarkParse)
|
|
91476
91483
|
.use(remarkMdx)
|
|
91477
91484
|
.use(normalize_malformed_md_syntax)
|
|
91478
|
-
.use([callouts, gemoji_])
|
|
91485
|
+
.use([[callouts, { isMdxish: true }], gemoji_, code_tabs])
|
|
91479
91486
|
.use(remarkGfm);
|
|
91480
91487
|
/**
|
|
91481
91488
|
* Check if children are only text nodes that might contain markdown
|
|
@@ -92344,7 +92351,12 @@ const defaultTransforms = {
|
|
|
92344
92351
|
imageTransformer: transform_images,
|
|
92345
92352
|
gemojiTransformer: gemoji_,
|
|
92346
92353
|
};
|
|
92347
|
-
const mdxishTransformers = [
|
|
92354
|
+
const mdxishTransformers = [
|
|
92355
|
+
[callouts, { isMdxish: true }],
|
|
92356
|
+
code_tabs,
|
|
92357
|
+
transform_images,
|
|
92358
|
+
gemoji_,
|
|
92359
|
+
];
|
|
92348
92360
|
/* harmony default export */ const transform = (Object.values(defaultTransforms));
|
|
92349
92361
|
|
|
92350
92362
|
;// ./lib/ast-processor.ts
|
|
@@ -107147,7 +107159,7 @@ const tocToHast = (headings = [], variables) => {
|
|
|
107147
107159
|
stack.pop();
|
|
107148
107160
|
}
|
|
107149
107161
|
if (heading.properties) {
|
|
107150
|
-
const content = lib_plain({ type: 'root', children: heading.children }, { variables: flatVars });
|
|
107162
|
+
const content = lib_plain({ type: 'root', children: heading.children }, { separator: '', variables: flatVars });
|
|
107151
107163
|
stack[stack.length - 1].children.push(hastscript_lib_h('li', null, hastscript_lib_h('a', { href: `#${heading.properties.id}` }, content)));
|
|
107152
107164
|
}
|
|
107153
107165
|
});
|
|
@@ -113958,6 +113970,14 @@ const rehypeMdxishComponents = ({ components, processMarkdown }) => {
|
|
|
113958
113970
|
visit(tree, 'element', (node, index, parent) => {
|
|
113959
113971
|
if (index === undefined || !parent)
|
|
113960
113972
|
return;
|
|
113973
|
+
// Parse Image caption as markdown so it renders formatted (bold, code,
|
|
113974
|
+
// decoded entities) in the figcaption instead of as a raw string.
|
|
113975
|
+
// rehypeRaw strips children from <img> (void element), so we must
|
|
113976
|
+
// re-process the caption here, after rehypeRaw.
|
|
113977
|
+
if (node.tagName === 'img' && typeof node.properties?.caption === 'string' && !node.children?.length) {
|
|
113978
|
+
const captionHast = processMarkdown(node.properties.caption);
|
|
113979
|
+
node.children = (captionHast.children ?? []).filter(isElementContentNode);
|
|
113980
|
+
}
|
|
113961
113981
|
// Skip runtime components and standard HTML tags
|
|
113962
113982
|
if (RUNTIME_COMPONENT_TAGS.has(node.tagName))
|
|
113963
113983
|
return;
|
|
@@ -116020,6 +116040,21 @@ const stripClosingTagFromParagraph = (node, tag) => {
|
|
|
116020
116040
|
if (closingIndex === -1)
|
|
116021
116041
|
return { paragraph: node, found: false };
|
|
116022
116042
|
children.splice(closingIndex, 1);
|
|
116043
|
+
// After removing the closing tag, trim trailing whitespace/newlines from the
|
|
116044
|
+
// preceding text node. Remark parses "Hello\n</Callout>" as text("Hello\n") +
|
|
116045
|
+
// html("</Callout>"), and the leftover \n would be converted to <br> in HAST.
|
|
116046
|
+
if (closingIndex > 0) {
|
|
116047
|
+
const prev = children[closingIndex - 1];
|
|
116048
|
+
if (prev.type === 'text') {
|
|
116049
|
+
const trimmed = prev.value.trimEnd();
|
|
116050
|
+
if (trimmed) {
|
|
116051
|
+
prev.value = trimmed;
|
|
116052
|
+
}
|
|
116053
|
+
else {
|
|
116054
|
+
children.splice(closingIndex - 1, 1);
|
|
116055
|
+
}
|
|
116056
|
+
}
|
|
116057
|
+
}
|
|
116023
116058
|
return { paragraph: { ...node, children }, found: true };
|
|
116024
116059
|
};
|
|
116025
116060
|
/**
|
|
@@ -116632,6 +116667,7 @@ const mdxishInlineComponents = () => tree => {
|
|
|
116632
116667
|
|
|
116633
116668
|
|
|
116634
116669
|
|
|
116670
|
+
|
|
116635
116671
|
const transformAnchor = (jsx) => {
|
|
116636
116672
|
const attrs = getAttrs(jsx);
|
|
116637
116673
|
const { href = '', label, target, title } = attrs;
|
|
@@ -116671,6 +116707,7 @@ const transformImage = (jsx) => {
|
|
|
116671
116707
|
alt,
|
|
116672
116708
|
border: border !== undefined ? String(border) : undefined,
|
|
116673
116709
|
caption,
|
|
116710
|
+
children: caption ? lib_mdast(caption).children : [],
|
|
116674
116711
|
className,
|
|
116675
116712
|
height: height !== undefined ? String(height) : undefined,
|
|
116676
116713
|
lazy,
|
|
@@ -119151,7 +119188,12 @@ function loadComponents() {
|
|
|
119151
119188
|
|
|
119152
119189
|
|
|
119153
119190
|
|
|
119154
|
-
const defaultTransformers = [
|
|
119191
|
+
const defaultTransformers = [
|
|
119192
|
+
[callouts, { isMdxish: true }],
|
|
119193
|
+
code_tabs,
|
|
119194
|
+
gemoji_,
|
|
119195
|
+
transform_embeds,
|
|
119196
|
+
];
|
|
119155
119197
|
/**
|
|
119156
119198
|
* Preprocessing pipeline: applies string-level transformations to work around
|
|
119157
119199
|
* CommonMark/remark limitations and reach parity with legacy (rdmd) rendering.
|
|
@@ -119198,8 +119240,21 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
119198
119240
|
? [jsxTable(), magicBlock(), legacyVariable(), looseHtmlEntity()]
|
|
119199
119241
|
: [jsxTable(), magicBlock(), mdxExprTextOnly, legacyVariable(), looseHtmlEntity()])
|
|
119200
119242
|
.data('fromMarkdownExtensions', safeMode
|
|
119201
|
-
? [
|
|
119202
|
-
|
|
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
|
+
])
|
|
119203
119258
|
.use(remarkParse)
|
|
119204
119259
|
.use(remarkFrontmatter)
|
|
119205
119260
|
.use(normalize_malformed_md_syntax)
|