@readme/markdown 13.6.2 → 13.7.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/components/Image/index.tsx +60 -39
- package/components/Image/style.scss +1 -0
- package/dist/lib/ast-processor.d.ts +3 -3
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/main.js +207 -64
- package/dist/main.node.js +192 -59
- 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/dist/processor/transform/mdxish/mdxish-jsx-to-mdast.d.ts +2 -1
- package/package.json +2 -1
package/dist/main.node.js
CHANGED
|
@@ -24514,6 +24514,16 @@ const CreateHeading = (depth) => {
|
|
|
24514
24514
|
|
|
24515
24515
|
;// ./components/Image/index.tsx
|
|
24516
24516
|
|
|
24517
|
+
|
|
24518
|
+
/**
|
|
24519
|
+
* Renders lightbox overlay via a React portal to document.body so it escapes
|
|
24520
|
+
* any intermediate CSS stacking contexts and reliably covers all UI chrome.
|
|
24521
|
+
*/
|
|
24522
|
+
const LightboxPortal = ({ children }) => {
|
|
24523
|
+
if (typeof document === 'undefined')
|
|
24524
|
+
return null;
|
|
24525
|
+
return (0,external_react_dom_namespaceObject.createPortal)(children, document.body);
|
|
24526
|
+
};
|
|
24517
24527
|
const Image = (Props) => {
|
|
24518
24528
|
const { align = '', alt = '', border: borderProp = false, caption, className = '', height = 'auto', src, title = '', width = 'auto', lazy = true, children, } = Props;
|
|
24519
24529
|
// Normalize border: MDXish passes {false} as the string "false", not a boolean
|
|
@@ -24546,20 +24556,27 @@ const Image = (Props) => {
|
|
|
24546
24556
|
return;
|
|
24547
24557
|
setLightbox(!lightbox);
|
|
24548
24558
|
};
|
|
24559
|
+
const imgElement = (external_react_.createElement("img", { alt: alt, className: `img ${caption || children ? 'img-align-center' : align ? `img-align-${align}` : ''} ${border ? 'border' : ''}`, height: height, loading: lazy ? 'lazy' : 'eager', src: src, title: title, width: width }));
|
|
24560
|
+
const lightboxOverlay = lightbox ? (external_react_.createElement(LightboxPortal, null,
|
|
24561
|
+
external_react_.createElement("div", { className: "markdown-body" },
|
|
24562
|
+
external_react_.createElement("span", { "aria-label": alt || 'Collapse image', className: "img lightbox open", onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
|
|
24563
|
+
external_react_.createElement("span", { className: "lightbox-inner" },
|
|
24564
|
+
imgElement,
|
|
24565
|
+
(children || caption) && external_react_.createElement("figcaption", null, children || caption))),
|
|
24566
|
+
external_react_.createElement("button", { "aria-label": "Minimize image", className: "lightbox-close", onClick: toggle, type: "button" },
|
|
24567
|
+
external_react_.createElement("i", { "aria-hidden": "true", className: "fa-solid fa-xmark" }))))) : null;
|
|
24549
24568
|
if (children || caption) {
|
|
24550
24569
|
return (external_react_.createElement("figure", null,
|
|
24551
|
-
external_react_.createElement("span", { "aria-label": alt, className:
|
|
24570
|
+
external_react_.createElement("span", { "aria-label": alt, className: "img lightbox closed", onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
|
|
24552
24571
|
external_react_.createElement("span", { className: "lightbox-inner" },
|
|
24553
|
-
|
|
24572
|
+
imgElement,
|
|
24554
24573
|
external_react_.createElement("figcaption", null, children || caption))),
|
|
24555
|
-
|
|
24556
|
-
external_react_.createElement("i", { "aria-hidden": "true", className: "fa-solid fa-xmark" })))));
|
|
24574
|
+
lightboxOverlay));
|
|
24557
24575
|
}
|
|
24558
|
-
return (external_react_.createElement(
|
|
24559
|
-
external_react_.createElement("span", { className: "lightbox
|
|
24560
|
-
external_react_.createElement("
|
|
24561
|
-
|
|
24562
|
-
external_react_.createElement("i", { "aria-hidden": "true", className: "fa-solid fa-xmark" })))));
|
|
24576
|
+
return (external_react_.createElement(external_react_.Fragment, null,
|
|
24577
|
+
external_react_.createElement("span", { "aria-label": "Expand image", className: "img lightbox closed", onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
|
|
24578
|
+
external_react_.createElement("span", { className: "lightbox-inner" }, imgElement)),
|
|
24579
|
+
lightboxOverlay));
|
|
24563
24580
|
};
|
|
24564
24581
|
/* harmony default export */ const components_Image = (Image);
|
|
24565
24582
|
|
|
@@ -46998,13 +47015,9 @@ function listItemWithTaskListItem(node, parent, state, info) {
|
|
|
46998
47015
|
|
|
46999
47016
|
;// ./node_modules/mdast-util-gfm/lib/index.js
|
|
47000
47017
|
/**
|
|
47001
|
-
* @
|
|
47002
|
-
* @
|
|
47003
|
-
|
|
47004
|
-
|
|
47005
|
-
/**
|
|
47006
|
-
* @typedef {import('mdast-util-gfm-table').Options} Options
|
|
47007
|
-
* Configuration.
|
|
47018
|
+
* @import {Extension as FromMarkdownExtension} from 'mdast-util-from-markdown'
|
|
47019
|
+
* @import {Options} from 'mdast-util-gfm'
|
|
47020
|
+
* @import {Options as ToMarkdownExtension} from 'mdast-util-to-markdown'
|
|
47008
47021
|
*/
|
|
47009
47022
|
|
|
47010
47023
|
|
|
@@ -47036,7 +47049,7 @@ function gfmFromMarkdown() {
|
|
|
47036
47049
|
* literals, footnotes, strikethrough, tables, tasklists).
|
|
47037
47050
|
*
|
|
47038
47051
|
* @param {Options | null | undefined} [options]
|
|
47039
|
-
* Configuration.
|
|
47052
|
+
* Configuration (optional).
|
|
47040
47053
|
* @returns {ToMarkdownExtension}
|
|
47041
47054
|
* Extension for `mdast-util-to-markdown` to enable GFM (autolink literals,
|
|
47042
47055
|
* footnotes, strikethrough, tables, tasklists).
|
|
@@ -47045,7 +47058,7 @@ function gfmToMarkdown(options) {
|
|
|
47045
47058
|
return {
|
|
47046
47059
|
extensions: [
|
|
47047
47060
|
gfmAutolinkLiteralToMarkdown(),
|
|
47048
|
-
gfmFootnoteToMarkdown(),
|
|
47061
|
+
gfmFootnoteToMarkdown(options),
|
|
47049
47062
|
gfmStrikethroughToMarkdown(),
|
|
47050
47063
|
gfmTableToMarkdown(options),
|
|
47051
47064
|
gfmTaskListItemToMarkdown()
|
|
@@ -73285,7 +73298,7 @@ const titleParser = unified().use(remarkParse).use(remarkGfm);
|
|
|
73285
73298
|
// The title paragraph may contain custom AST nodes that `toMarkdown` doesn't
|
|
73286
73299
|
// natively understand
|
|
73287
73300
|
const toMarkdownExtensions = [
|
|
73288
|
-
|
|
73301
|
+
gfmToMarkdown(),
|
|
73289
73302
|
// For mdx variable syntaxes (e.g., {user.name})
|
|
73290
73303
|
mdxExpressionToMarkdown(),
|
|
73291
73304
|
// Important: This is required and would crash the parser if there's no variable node handler
|
|
@@ -73377,7 +73390,7 @@ const removeIconPrefix = (paragraph, prefixLength) => {
|
|
|
73377
73390
|
firstTextNode.value = firstTextNode.value.slice(prefixLength);
|
|
73378
73391
|
}
|
|
73379
73392
|
};
|
|
73380
|
-
const processBlockquote = (node, index, parent) => {
|
|
73393
|
+
const processBlockquote = (node, index, parent, isMdxish = false) => {
|
|
73381
73394
|
if (!isCalloutStructure(node)) {
|
|
73382
73395
|
// Only stringify empty blockquotes (no extractable text content)
|
|
73383
73396
|
// Preserve blockquotes with actual content (e.g., headings, lists, etc.)
|
|
@@ -73425,7 +73438,11 @@ const processBlockquote = (node, index, parent) => {
|
|
|
73425
73438
|
node.children[0].position.start.offset += match.length;
|
|
73426
73439
|
node.children[0].position.start.column += match.length;
|
|
73427
73440
|
}
|
|
73428
|
-
else {
|
|
73441
|
+
else if (isMdxish) {
|
|
73442
|
+
// Block-level title re-parsing is only needed for MDXish where HTML stays
|
|
73443
|
+
// as raw nodes. In MDX, remarkMdx has already converted HTML to JSX AST
|
|
73444
|
+
// nodes which toMarkdown can't serialize — and MDX doesn't need this
|
|
73445
|
+
// block-level title handling anyway.
|
|
73429
73446
|
const headingText = toMarkdown({ type: 'root', children: [firstParagraph] }, {
|
|
73430
73447
|
extensions: toMarkdownExtensions,
|
|
73431
73448
|
})
|
|
@@ -73451,6 +73468,11 @@ const processBlockquote = (node, index, parent) => {
|
|
|
73451
73468
|
node.children[0].position.start.column += match.length;
|
|
73452
73469
|
}
|
|
73453
73470
|
}
|
|
73471
|
+
else {
|
|
73472
|
+
node.children[0] = wrapHeading(node);
|
|
73473
|
+
node.children[0].position.start.offset += match.length;
|
|
73474
|
+
node.children[0].position.start.column += match.length;
|
|
73475
|
+
}
|
|
73454
73476
|
}
|
|
73455
73477
|
// Insert body content as a separate paragraph after the heading
|
|
73456
73478
|
if (bodyChildren) {
|
|
@@ -73481,10 +73503,10 @@ const processBlockquote = (node, index, parent) => {
|
|
|
73481
73503
|
});
|
|
73482
73504
|
}
|
|
73483
73505
|
};
|
|
73484
|
-
const calloutTransformer = () => {
|
|
73506
|
+
const calloutTransformer = ({ isMdxish = false } = {}) => {
|
|
73485
73507
|
const processNode = (root) => {
|
|
73486
73508
|
visit(root, 'blockquote', (node, index, parent) => {
|
|
73487
|
-
processBlockquote(node, index, parent);
|
|
73509
|
+
processBlockquote(node, index, parent, isMdxish);
|
|
73488
73510
|
if (node.type === NodeTypes.callout) {
|
|
73489
73511
|
// SKIP prevents re-processing synthetic blockquotes in parsed title content
|
|
73490
73512
|
// (e.g., blockquotes from "> Quote" titles). Recursively process body children
|
|
@@ -91477,7 +91499,7 @@ const tableNodeProcessor = unified()
|
|
|
91477
91499
|
.use(remarkParse)
|
|
91478
91500
|
.use(remarkMdx)
|
|
91479
91501
|
.use(normalize_malformed_md_syntax)
|
|
91480
|
-
.use([callouts, gemoji_, code_tabs])
|
|
91502
|
+
.use([[callouts, { isMdxish: true }], gemoji_, code_tabs])
|
|
91481
91503
|
.use(remarkGfm);
|
|
91482
91504
|
/**
|
|
91483
91505
|
* Check if children are only text nodes that might contain markdown
|
|
@@ -92346,7 +92368,12 @@ const defaultTransforms = {
|
|
|
92346
92368
|
imageTransformer: transform_images,
|
|
92347
92369
|
gemojiTransformer: gemoji_,
|
|
92348
92370
|
};
|
|
92349
|
-
const mdxishTransformers = [
|
|
92371
|
+
const mdxishTransformers = [
|
|
92372
|
+
[callouts, { isMdxish: true }],
|
|
92373
|
+
code_tabs,
|
|
92374
|
+
transform_images,
|
|
92375
|
+
gemoji_,
|
|
92376
|
+
];
|
|
92350
92377
|
/* harmony default export */ const transform = (Object.values(defaultTransforms));
|
|
92351
92378
|
|
|
92352
92379
|
;// ./lib/ast-processor.ts
|
|
@@ -115655,7 +115682,7 @@ function transformMagicBlock(blockType, data, rawValue, options = {}) {
|
|
|
115655
115682
|
data: {
|
|
115656
115683
|
hProperties: {
|
|
115657
115684
|
...(imgData.align && { align: imgData.align }),
|
|
115658
|
-
...(imgData.border && { border: imgData.border
|
|
115685
|
+
...(imgData.border !== undefined && { border: String(imgData.border) !== 'false' }),
|
|
115659
115686
|
...(imgData.sizing && { width: imgWidthBySize[imgData.sizing] }),
|
|
115660
115687
|
},
|
|
115661
115688
|
},
|
|
@@ -115934,7 +115961,7 @@ const constants_INLINE_COMPONENT_TAGS = new Set(['Anchor']);
|
|
|
115934
115961
|
|
|
115935
115962
|
|
|
115936
115963
|
|
|
115937
|
-
const pascalCaseTagPattern = /^<([A-Z][A-Za-z0-9_]*)([^>]*?)(\/?)>([\s\S]*)?$/;
|
|
115964
|
+
const pascalCaseTagPattern = /^<([A-Z][A-Za-z0-9_]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>([\s\S]*)?$/;
|
|
115938
115965
|
const tagAttributePattern = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s"'>]+))?/g;
|
|
115939
115966
|
/**
|
|
115940
115967
|
* Maximum number of siblings to scan forward when looking for a closing tag
|
|
@@ -116658,6 +116685,30 @@ const mdxishInlineComponents = () => tree => {
|
|
|
116658
116685
|
|
|
116659
116686
|
|
|
116660
116687
|
|
|
116688
|
+
function toImageAlign(value) {
|
|
116689
|
+
if (value === 'left' || value === 'center' || value === 'right') {
|
|
116690
|
+
return value;
|
|
116691
|
+
}
|
|
116692
|
+
return undefined;
|
|
116693
|
+
}
|
|
116694
|
+
function toBool(value) {
|
|
116695
|
+
if (value === undefined)
|
|
116696
|
+
return undefined;
|
|
116697
|
+
if (typeof value === 'boolean')
|
|
116698
|
+
return value;
|
|
116699
|
+
return value !== '' && value !== 'false';
|
|
116700
|
+
}
|
|
116701
|
+
function mdxish_jsx_to_mdast_extractText(nodes) {
|
|
116702
|
+
return nodes
|
|
116703
|
+
.map(n => {
|
|
116704
|
+
if ('value' in n && typeof n.value === 'string')
|
|
116705
|
+
return n.value;
|
|
116706
|
+
if ('children' in n)
|
|
116707
|
+
return mdxish_jsx_to_mdast_extractText(n.children);
|
|
116708
|
+
return '';
|
|
116709
|
+
})
|
|
116710
|
+
.join('');
|
|
116711
|
+
}
|
|
116661
116712
|
const transformAnchor = (jsx) => {
|
|
116662
116713
|
const attrs = getAttrs(jsx);
|
|
116663
116714
|
const { href = '', label, target, title } = attrs;
|
|
@@ -116679,31 +116730,35 @@ const transformAnchor = (jsx) => {
|
|
|
116679
116730
|
const transformImage = (jsx) => {
|
|
116680
116731
|
const attrs = getAttrs(jsx);
|
|
116681
116732
|
const { align, alt = '', border, caption, className, height, lazy, src = '', title = '', width } = attrs;
|
|
116733
|
+
const validAlign = toImageAlign(align);
|
|
116734
|
+
const sizing = width !== undefined ? String(width) : undefined;
|
|
116682
116735
|
const hProperties = {
|
|
116683
116736
|
alt,
|
|
116684
116737
|
src,
|
|
116685
116738
|
title,
|
|
116686
|
-
...(
|
|
116687
|
-
...(border !== undefined && { border:
|
|
116739
|
+
...(validAlign && { align: validAlign }),
|
|
116740
|
+
...(border !== undefined && { border: toBool(border) }),
|
|
116688
116741
|
...(caption && { caption }),
|
|
116689
116742
|
...(className && { className }),
|
|
116690
116743
|
...(height !== undefined && { height: String(height) }),
|
|
116691
|
-
...(lazy !== undefined && { lazy }),
|
|
116692
|
-
...(
|
|
116744
|
+
...(lazy !== undefined && { lazy: toBool(lazy) }),
|
|
116745
|
+
...(sizing && { sizing }),
|
|
116746
|
+
...(sizing && { width: sizing }),
|
|
116693
116747
|
};
|
|
116694
116748
|
return {
|
|
116695
116749
|
type: NodeTypes.imageBlock,
|
|
116696
|
-
align,
|
|
116750
|
+
align: validAlign,
|
|
116697
116751
|
alt,
|
|
116698
|
-
border:
|
|
116752
|
+
border: toBool(border),
|
|
116699
116753
|
caption,
|
|
116700
116754
|
children: caption ? lib_mdast(caption).children : [],
|
|
116701
116755
|
className,
|
|
116702
116756
|
height: height !== undefined ? String(height) : undefined,
|
|
116703
|
-
lazy,
|
|
116757
|
+
lazy: toBool(lazy),
|
|
116758
|
+
sizing,
|
|
116704
116759
|
src,
|
|
116705
116760
|
title,
|
|
116706
|
-
width:
|
|
116761
|
+
width: sizing,
|
|
116707
116762
|
data: {
|
|
116708
116763
|
hName: 'img',
|
|
116709
116764
|
hProperties,
|
|
@@ -116730,7 +116785,7 @@ const transformCallout = (jsx) => {
|
|
|
116730
116785
|
};
|
|
116731
116786
|
const transformEmbed = (jsx) => {
|
|
116732
116787
|
const attrs = getAttrs(jsx);
|
|
116733
|
-
const { favicon, height, html, iframe, image, providerName, providerUrl, title = '', typeOfEmbed, url = '', width } = attrs;
|
|
116788
|
+
const { favicon, height, html, iframe, image, providerName, providerUrl, title = '', typeOfEmbed, url = '', width, } = attrs;
|
|
116734
116789
|
return {
|
|
116735
116790
|
type: NodeTypes.embedBlock,
|
|
116736
116791
|
title,
|
|
@@ -116776,22 +116831,26 @@ const transformMagicBlockImage = (node) => {
|
|
|
116776
116831
|
const { alt = '', data, position, title = '', url = '' } = node;
|
|
116777
116832
|
const hProps = data?.hProperties || {};
|
|
116778
116833
|
const { align, border, width } = hProps;
|
|
116834
|
+
const validAlign = toImageAlign(align);
|
|
116835
|
+
const sizing = width || undefined;
|
|
116779
116836
|
const hProperties = {
|
|
116780
116837
|
alt,
|
|
116781
116838
|
src: url,
|
|
116782
116839
|
title,
|
|
116783
|
-
...(
|
|
116784
|
-
...(border && { border }),
|
|
116785
|
-
...(
|
|
116840
|
+
...(validAlign && { align: validAlign }),
|
|
116841
|
+
...(border !== undefined && { border: toBool(border) }),
|
|
116842
|
+
...(sizing && { sizing }),
|
|
116843
|
+
...(sizing && { width: sizing }),
|
|
116786
116844
|
};
|
|
116787
116845
|
return {
|
|
116788
116846
|
type: NodeTypes.imageBlock,
|
|
116789
|
-
align,
|
|
116847
|
+
align: validAlign,
|
|
116790
116848
|
alt,
|
|
116791
|
-
border,
|
|
116849
|
+
border: toBool(border),
|
|
116850
|
+
sizing,
|
|
116792
116851
|
src: url,
|
|
116793
116852
|
title,
|
|
116794
|
-
width,
|
|
116853
|
+
width: sizing,
|
|
116795
116854
|
data: {
|
|
116796
116855
|
hName: 'img',
|
|
116797
116856
|
hProperties,
|
|
@@ -116839,7 +116898,8 @@ const COMPONENT_MAP = {
|
|
|
116839
116898
|
* - JSX component elements (Image, Callout, Embed, Recipe) into their corresponding MDAST types
|
|
116840
116899
|
* - Magic block image nodes (type: 'image') into image-block
|
|
116841
116900
|
* - Magic block embed nodes (type: 'embed') into embed-block
|
|
116842
|
-
* - Figure nodes
|
|
116901
|
+
* - Figure nodes (magic blocks with captions) into flat image-block with caption string
|
|
116902
|
+
* - Normalizes all image-block attrs (border, align, sizing, caption) to a consistent shape
|
|
116843
116903
|
*
|
|
116844
116904
|
* This is controlled by the `newEditorTypes` flag to maintain backwards compatibility.
|
|
116845
116905
|
*/
|
|
@@ -116865,12 +116925,10 @@ const mdxishJsxToMdast = () => tree => {
|
|
|
116865
116925
|
}
|
|
116866
116926
|
});
|
|
116867
116927
|
// Transform magic block images (type: 'image') to image-block
|
|
116868
|
-
//
|
|
116869
|
-
// Magic block images are direct children of root, so we handle them here
|
|
116928
|
+
// Images inside paragraphs are standard markdown — handled by imageTransformer, normalized below
|
|
116870
116929
|
visit(tree, 'image', (node, index, parent) => {
|
|
116871
116930
|
if (!parent || index === undefined)
|
|
116872
116931
|
return SKIP;
|
|
116873
|
-
// Skip images inside paragraphs (those are standard markdown images handled by imageTransformer)
|
|
116874
116932
|
if (parent.type === 'paragraph')
|
|
116875
116933
|
return SKIP;
|
|
116876
116934
|
const newNode = transformMagicBlockImage(node);
|
|
@@ -116885,16 +116943,74 @@ const mdxishJsxToMdast = () => tree => {
|
|
|
116885
116943
|
parent.children[index] = newNode;
|
|
116886
116944
|
return SKIP;
|
|
116887
116945
|
});
|
|
116888
|
-
//
|
|
116946
|
+
// Flatten figure nodes (magic blocks with captions) into image-block nodes
|
|
116889
116947
|
const isFigure = (node) => node.type === 'figure';
|
|
116890
|
-
visit(tree, isFigure, node => {
|
|
116891
|
-
|
|
116892
|
-
|
|
116893
|
-
|
|
116894
|
-
|
|
116895
|
-
|
|
116896
|
-
|
|
116897
|
-
|
|
116948
|
+
visit(tree, isFigure, (node, index, parent) => {
|
|
116949
|
+
if (!parent || index === undefined)
|
|
116950
|
+
return;
|
|
116951
|
+
const imageChild = node.children.find(child => child.type === 'image' || child.type === NodeTypes.imageBlock);
|
|
116952
|
+
if (!imageChild)
|
|
116953
|
+
return;
|
|
116954
|
+
const figcaptionChild = node.children.find(child => child.type === 'figcaption');
|
|
116955
|
+
// If the image was already transformed to image-block by the earlier visitor, use it directly
|
|
116956
|
+
const imageBlock = imageChild.type === NodeTypes.imageBlock
|
|
116957
|
+
? imageChild
|
|
116958
|
+
: transformMagicBlockImage(imageChild);
|
|
116959
|
+
if (figcaptionChild?.children) {
|
|
116960
|
+
const caption = mdxish_jsx_to_mdast_extractText(figcaptionChild.children);
|
|
116961
|
+
if (caption) {
|
|
116962
|
+
imageBlock.caption = caption;
|
|
116963
|
+
imageBlock.data.hProperties.caption = caption;
|
|
116964
|
+
}
|
|
116965
|
+
}
|
|
116966
|
+
parent.children[index] = imageBlock;
|
|
116967
|
+
});
|
|
116968
|
+
// Final normalization pass across all image-block nodes
|
|
116969
|
+
// Ensures consistent types (border→boolean, align→ImageAlign, width→sizing) and cleans up artifacts
|
|
116970
|
+
const isImageBlock = (node) => node.type === NodeTypes.imageBlock;
|
|
116971
|
+
visit(tree, isImageBlock, _node => {
|
|
116972
|
+
const node = _node;
|
|
116973
|
+
const hProps = (node.data?.hProperties || {});
|
|
116974
|
+
// Normalize boolean attrs
|
|
116975
|
+
if (hProps.border !== undefined) {
|
|
116976
|
+
const val = toBool(hProps.border);
|
|
116977
|
+
node.border = val;
|
|
116978
|
+
hProps.border = val;
|
|
116979
|
+
}
|
|
116980
|
+
else if (node.border !== undefined) {
|
|
116981
|
+
node.border = toBool(node.border);
|
|
116982
|
+
}
|
|
116983
|
+
// Validate align
|
|
116984
|
+
const validAlign = toImageAlign(hProps.align) || toImageAlign(node.align);
|
|
116985
|
+
node.align = validAlign;
|
|
116986
|
+
if (validAlign) {
|
|
116987
|
+
hProps.align = validAlign;
|
|
116988
|
+
}
|
|
116989
|
+
else {
|
|
116990
|
+
delete hProps.align;
|
|
116991
|
+
}
|
|
116992
|
+
// Map width → sizing
|
|
116993
|
+
const width = hProps.width || node.width;
|
|
116994
|
+
if (width) {
|
|
116995
|
+
node.sizing = width;
|
|
116996
|
+
node.width = width;
|
|
116997
|
+
hProps.sizing = width;
|
|
116998
|
+
hProps.width = width;
|
|
116999
|
+
}
|
|
117000
|
+
// Normalize caption
|
|
117001
|
+
const caption = hProps.caption || node.caption;
|
|
117002
|
+
if (caption) {
|
|
117003
|
+
node.caption = caption;
|
|
117004
|
+
hProps.caption = caption;
|
|
117005
|
+
}
|
|
117006
|
+
// Normalize src (url → src)
|
|
117007
|
+
node.src = hProps.src || node.src;
|
|
117008
|
+
hProps.src = node.src;
|
|
117009
|
+
// Remove stray children array from imageTransformer, but preserve caption children
|
|
117010
|
+
if (!caption) {
|
|
117011
|
+
delete node.children;
|
|
117012
|
+
}
|
|
117013
|
+
delete hProps.children;
|
|
116898
117014
|
});
|
|
116899
117015
|
return tree;
|
|
116900
117016
|
};
|
|
@@ -119178,7 +119294,12 @@ function loadComponents() {
|
|
|
119178
119294
|
|
|
119179
119295
|
|
|
119180
119296
|
|
|
119181
|
-
const defaultTransformers = [
|
|
119297
|
+
const defaultTransformers = [
|
|
119298
|
+
[callouts, { isMdxish: true }],
|
|
119299
|
+
code_tabs,
|
|
119300
|
+
gemoji_,
|
|
119301
|
+
transform_embeds,
|
|
119302
|
+
];
|
|
119182
119303
|
/**
|
|
119183
119304
|
* Preprocessing pipeline: applies string-level transformations to work around
|
|
119184
119305
|
* CommonMark/remark limitations and reach parity with legacy (rdmd) rendering.
|
|
@@ -119225,8 +119346,21 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
119225
119346
|
? [jsxTable(), magicBlock(), legacyVariable(), looseHtmlEntity()]
|
|
119226
119347
|
: [jsxTable(), magicBlock(), mdxExprTextOnly, legacyVariable(), looseHtmlEntity()])
|
|
119227
119348
|
.data('fromMarkdownExtensions', safeMode
|
|
119228
|
-
? [
|
|
119229
|
-
|
|
119349
|
+
? [
|
|
119350
|
+
jsxTableFromMarkdown(),
|
|
119351
|
+
magicBlockFromMarkdown(),
|
|
119352
|
+
legacyVariableFromMarkdown(),
|
|
119353
|
+
emptyTaskListItemFromMarkdown(),
|
|
119354
|
+
looseHtmlEntityFromMarkdown(),
|
|
119355
|
+
]
|
|
119356
|
+
: [
|
|
119357
|
+
jsxTableFromMarkdown(),
|
|
119358
|
+
magicBlockFromMarkdown(),
|
|
119359
|
+
mdxExpressionFromMarkdown(),
|
|
119360
|
+
legacyVariableFromMarkdown(),
|
|
119361
|
+
emptyTaskListItemFromMarkdown(),
|
|
119362
|
+
looseHtmlEntityFromMarkdown(),
|
|
119363
|
+
])
|
|
119230
119364
|
.use(remarkParse)
|
|
119231
119365
|
.use(remarkFrontmatter)
|
|
119232
119366
|
.use(normalize_malformed_md_syntax)
|
|
@@ -119239,7 +119373,6 @@ function mdxishAstProcessor(mdContent, opts = {}) {
|
|
|
119239
119373
|
.use(mdxish_html_blocks)
|
|
119240
119374
|
.use(newEditorTypes ? mdxish_inline_components : undefined) // Merge inline html components (e.g. <Anchor>) into MDAST nodes
|
|
119241
119375
|
.use(newEditorTypes ? mdxish_jsx_to_mdast : undefined) // Convert block JSX elements to MDAST types
|
|
119242
|
-
.use(safeMode ? undefined : evaluate_expressions, { context: jsxContext }) // Evaluate MDX expressions using jsxContext
|
|
119243
119376
|
.use(variables_text) // Parse {user.*} patterns from text nodes
|
|
119244
119377
|
.use(useTailwind ? transform_tailwind : undefined, { components: tempComponentsMap })
|
|
119245
119378
|
.use(remarkGfm);
|