@readme/markdown 14.7.0 → 14.7.2
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 +18 -5
- package/components/Image/style.scss +5 -2
- package/dist/components/Image/index.d.ts +3 -2
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/main.js +29 -9
- package/dist/main.node.js +29 -9
- package/dist/main.node.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -12209,7 +12209,7 @@ const LightboxPortal = ({ children }) => {
|
|
|
12209
12209
|
return (0,external_amd_react_dom_commonjs2_react_dom_commonjs_react_dom_root_ReactDOM_umd_react_dom_.createPortal)(children, document.body);
|
|
12210
12210
|
};
|
|
12211
12211
|
const Image = (Props) => {
|
|
12212
|
-
const { align = '', alt = '', border: borderProp = false, caption, className = '', framed: framedProp = false, height = 'auto', src, title = '', width = 'auto', lazy = true, children, wrap: wrapProp, } = Props;
|
|
12212
|
+
const { align = '', alt = '', border: borderProp = false, caption, className = '', framed: framedProp = false, height = Props.style?.height ?? 'auto', src, style, title = '', width = Props.style?.width ?? 'auto', lazy = true, children, wrap: wrapProp, } = Props;
|
|
12213
12213
|
// Normalize border/framed: MDXish passes {false} as the string "false", not a boolean
|
|
12214
12214
|
const border = borderProp === true || borderProp === 'true';
|
|
12215
12215
|
const framed = framedProp === true || framedProp === 'true';
|
|
@@ -12217,7 +12217,7 @@ const Image = (Props) => {
|
|
|
12217
12217
|
const noWrap = (align === 'left' || align === 'right') && (wrapProp === false || wrapProp === 'false');
|
|
12218
12218
|
const [lightbox, setLightbox] = external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useState(false);
|
|
12219
12219
|
if (className === 'emoji') {
|
|
12220
|
-
return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { alt: alt, height: height, loading: lazy ? 'lazy' : 'eager', src: src, title: title, width: width });
|
|
12220
|
+
return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { alt: alt, height: height, loading: lazy ? 'lazy' : 'eager', src: src, style: style, title: title, width: width }));
|
|
12221
12221
|
}
|
|
12222
12222
|
const handleKeyDown = ({ key, metaKey: cmd }) => {
|
|
12223
12223
|
const cmdKey = cmd ? 'cmd+' : '';
|
|
@@ -12245,7 +12245,7 @@ const Image = (Props) => {
|
|
|
12245
12245
|
};
|
|
12246
12246
|
// Framed images center the <img> itself; outer wrapper handles left/right alignment via text-align.
|
|
12247
12247
|
const imgClass = `img ${caption || children || framed ? 'img-align-center' : align ? `img-align-${align}` : ''} ${border ? 'border' : ''}${noWrap ? ' img-no-wrap' : ''}`;
|
|
12248
|
-
const imgElement = (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { alt: alt, className: imgClass, height: height, loading: lazy ? 'lazy' : 'eager', src: src, title: title, width: width }));
|
|
12248
|
+
const imgElement = (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { alt: alt, className: imgClass, height: height, loading: lazy ? 'lazy' : 'eager', src: src, style: style, title: title, width: width }));
|
|
12249
12249
|
const closedLightbox = (ariaLabel, content) => (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": ariaLabel, className: "img lightbox closed", onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
|
|
12250
12250
|
external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" }, content)));
|
|
12251
12251
|
const lightboxOverlay = lightbox ? (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement(LightboxPortal, null,
|
|
@@ -76355,13 +76355,32 @@ const processTableNode = (node, index, parent, documentPosition) => {
|
|
|
76355
76355
|
// remarkMdx wraps inline `<tr>`s in a paragraph; unwrap one level so the
|
|
76356
76356
|
// hasRow check below sees them.
|
|
76357
76357
|
const flattenSectionChildren = (nodes) => nodes.flatMap(n => n.type === 'paragraph' && 'children' in n && Array.isArray(n.children) ? n.children : [n]);
|
|
76358
|
-
|
|
76359
|
-
|
|
76358
|
+
// Iterate the table's direct children in document order. Rows may live
|
|
76359
|
+
// inside a `<thead>`/`<tbody>` section, or sit bare directly under the table
|
|
76360
|
+
// with no section wrapper — both are collected here so the first row becomes
|
|
76361
|
+
// the markdown table header.
|
|
76362
|
+
const tableChildren = flattenSectionChildren(node.children);
|
|
76363
|
+
tableChildren.forEach(child => {
|
|
76364
|
+
if (!isMDXElement(child))
|
|
76365
|
+
return;
|
|
76366
|
+
const childElement = child;
|
|
76367
|
+
// Path for a `<tr>` directly under the table, without a `<thead>`/`<tbody>` wrapper.
|
|
76368
|
+
if (childElement.name === 'tr') {
|
|
76369
|
+
children.push({
|
|
76370
|
+
type: 'tableRow',
|
|
76371
|
+
children: collectCells(childElement),
|
|
76372
|
+
position: childElement.position,
|
|
76373
|
+
});
|
|
76374
|
+
return;
|
|
76375
|
+
}
|
|
76376
|
+
// Path for when the rows are wrapped in a `<thead>`/`<tbody>`
|
|
76377
|
+
// We visit & collect the entire rows under them directly here
|
|
76378
|
+
if (childElement.name !== 'thead' && childElement.name !== 'tbody')
|
|
76360
76379
|
return;
|
|
76361
|
-
const sectionChildren = flattenSectionChildren(
|
|
76380
|
+
const sectionChildren = flattenSectionChildren(childElement.children);
|
|
76362
76381
|
const hasRow = sectionChildren.some(c => isMDXElement(c) && c.name === 'tr');
|
|
76363
76382
|
if (hasRow) {
|
|
76364
|
-
visit(
|
|
76383
|
+
visit(childElement, isMDXElement, (row) => {
|
|
76365
76384
|
if (row.name !== 'tr')
|
|
76366
76385
|
return;
|
|
76367
76386
|
children.push({
|
|
@@ -76375,7 +76394,7 @@ const processTableNode = (node, index, parent, documentPosition) => {
|
|
|
76375
76394
|
// No `<tr>`, chunk bare cells into rows using the prior row's column
|
|
76376
76395
|
// count (e.g. from `<thead>`), so 4 bare `<td>`s under a 2-col header
|
|
76377
76396
|
// become 2 rows of 2.
|
|
76378
|
-
const cells = collectCells(
|
|
76397
|
+
const cells = collectCells(childElement);
|
|
76379
76398
|
if (cells.length === 0)
|
|
76380
76399
|
return;
|
|
76381
76400
|
const cols = children[0]?.children?.length || cells.length;
|
|
@@ -76383,11 +76402,12 @@ const processTableNode = (node, index, parent, documentPosition) => {
|
|
|
76383
76402
|
children.push({
|
|
76384
76403
|
type: 'tableRow',
|
|
76385
76404
|
children: cells.slice(i, i + cols),
|
|
76386
|
-
position:
|
|
76405
|
+
position: childElement.position,
|
|
76387
76406
|
});
|
|
76388
76407
|
}
|
|
76389
76408
|
}
|
|
76390
76409
|
});
|
|
76410
|
+
// Output the markdown table node
|
|
76391
76411
|
const firstRow = children[0];
|
|
76392
76412
|
const columnCount = firstRow?.children?.length || 0;
|
|
76393
76413
|
const alignArray = align && columnCount > 0
|
package/dist/main.node.js
CHANGED
|
@@ -24835,7 +24835,7 @@ const LightboxPortal = ({ children }) => {
|
|
|
24835
24835
|
return (0,external_react_dom_namespaceObject.createPortal)(children, document.body);
|
|
24836
24836
|
};
|
|
24837
24837
|
const Image = (Props) => {
|
|
24838
|
-
const { align = '', alt = '', border: borderProp = false, caption, className = '', framed: framedProp = false, height = 'auto', src, title = '', width = 'auto', lazy = true, children, wrap: wrapProp, } = Props;
|
|
24838
|
+
const { align = '', alt = '', border: borderProp = false, caption, className = '', framed: framedProp = false, height = Props.style?.height ?? 'auto', src, style, title = '', width = Props.style?.width ?? 'auto', lazy = true, children, wrap: wrapProp, } = Props;
|
|
24839
24839
|
// Normalize border/framed: MDXish passes {false} as the string "false", not a boolean
|
|
24840
24840
|
const border = borderProp === true || borderProp === 'true';
|
|
24841
24841
|
const framed = framedProp === true || framedProp === 'true';
|
|
@@ -24843,7 +24843,7 @@ const Image = (Props) => {
|
|
|
24843
24843
|
const noWrap = (align === 'left' || align === 'right') && (wrapProp === false || wrapProp === 'false');
|
|
24844
24844
|
const [lightbox, setLightbox] = external_react_.useState(false);
|
|
24845
24845
|
if (className === 'emoji') {
|
|
24846
|
-
return external_react_.createElement("img", { alt: alt, height: height, loading: lazy ? 'lazy' : 'eager', src: src, title: title, width: width });
|
|
24846
|
+
return (external_react_.createElement("img", { alt: alt, height: height, loading: lazy ? 'lazy' : 'eager', src: src, style: style, title: title, width: width }));
|
|
24847
24847
|
}
|
|
24848
24848
|
const handleKeyDown = ({ key, metaKey: cmd }) => {
|
|
24849
24849
|
const cmdKey = cmd ? 'cmd+' : '';
|
|
@@ -24871,7 +24871,7 @@ const Image = (Props) => {
|
|
|
24871
24871
|
};
|
|
24872
24872
|
// Framed images center the <img> itself; outer wrapper handles left/right alignment via text-align.
|
|
24873
24873
|
const imgClass = `img ${caption || children || framed ? 'img-align-center' : align ? `img-align-${align}` : ''} ${border ? 'border' : ''}${noWrap ? ' img-no-wrap' : ''}`;
|
|
24874
|
-
const imgElement = (external_react_.createElement("img", { alt: alt, className: imgClass, height: height, loading: lazy ? 'lazy' : 'eager', src: src, title: title, width: width }));
|
|
24874
|
+
const imgElement = (external_react_.createElement("img", { alt: alt, className: imgClass, height: height, loading: lazy ? 'lazy' : 'eager', src: src, style: style, title: title, width: width }));
|
|
24875
24875
|
const closedLightbox = (ariaLabel, content) => (external_react_.createElement("span", { "aria-label": ariaLabel, className: "img lightbox closed", onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
|
|
24876
24876
|
external_react_.createElement("span", { className: "lightbox-inner" }, content)));
|
|
24877
24877
|
const lightboxOverlay = lightbox ? (external_react_.createElement(LightboxPortal, null,
|
|
@@ -96579,13 +96579,32 @@ const processTableNode = (node, index, parent, documentPosition) => {
|
|
|
96579
96579
|
// remarkMdx wraps inline `<tr>`s in a paragraph; unwrap one level so the
|
|
96580
96580
|
// hasRow check below sees them.
|
|
96581
96581
|
const flattenSectionChildren = (nodes) => nodes.flatMap(n => n.type === 'paragraph' && 'children' in n && Array.isArray(n.children) ? n.children : [n]);
|
|
96582
|
-
|
|
96583
|
-
|
|
96582
|
+
// Iterate the table's direct children in document order. Rows may live
|
|
96583
|
+
// inside a `<thead>`/`<tbody>` section, or sit bare directly under the table
|
|
96584
|
+
// with no section wrapper — both are collected here so the first row becomes
|
|
96585
|
+
// the markdown table header.
|
|
96586
|
+
const tableChildren = flattenSectionChildren(node.children);
|
|
96587
|
+
tableChildren.forEach(child => {
|
|
96588
|
+
if (!isMDXElement(child))
|
|
96589
|
+
return;
|
|
96590
|
+
const childElement = child;
|
|
96591
|
+
// Path for a `<tr>` directly under the table, without a `<thead>`/`<tbody>` wrapper.
|
|
96592
|
+
if (childElement.name === 'tr') {
|
|
96593
|
+
children.push({
|
|
96594
|
+
type: 'tableRow',
|
|
96595
|
+
children: collectCells(childElement),
|
|
96596
|
+
position: childElement.position,
|
|
96597
|
+
});
|
|
96598
|
+
return;
|
|
96599
|
+
}
|
|
96600
|
+
// Path for when the rows are wrapped in a `<thead>`/`<tbody>`
|
|
96601
|
+
// We visit & collect the entire rows under them directly here
|
|
96602
|
+
if (childElement.name !== 'thead' && childElement.name !== 'tbody')
|
|
96584
96603
|
return;
|
|
96585
|
-
const sectionChildren = flattenSectionChildren(
|
|
96604
|
+
const sectionChildren = flattenSectionChildren(childElement.children);
|
|
96586
96605
|
const hasRow = sectionChildren.some(c => isMDXElement(c) && c.name === 'tr');
|
|
96587
96606
|
if (hasRow) {
|
|
96588
|
-
visit(
|
|
96607
|
+
visit(childElement, isMDXElement, (row) => {
|
|
96589
96608
|
if (row.name !== 'tr')
|
|
96590
96609
|
return;
|
|
96591
96610
|
children.push({
|
|
@@ -96599,7 +96618,7 @@ const processTableNode = (node, index, parent, documentPosition) => {
|
|
|
96599
96618
|
// No `<tr>`, chunk bare cells into rows using the prior row's column
|
|
96600
96619
|
// count (e.g. from `<thead>`), so 4 bare `<td>`s under a 2-col header
|
|
96601
96620
|
// become 2 rows of 2.
|
|
96602
|
-
const cells = collectCells(
|
|
96621
|
+
const cells = collectCells(childElement);
|
|
96603
96622
|
if (cells.length === 0)
|
|
96604
96623
|
return;
|
|
96605
96624
|
const cols = children[0]?.children?.length || cells.length;
|
|
@@ -96607,11 +96626,12 @@ const processTableNode = (node, index, parent, documentPosition) => {
|
|
|
96607
96626
|
children.push({
|
|
96608
96627
|
type: 'tableRow',
|
|
96609
96628
|
children: cells.slice(i, i + cols),
|
|
96610
|
-
position:
|
|
96629
|
+
position: childElement.position,
|
|
96611
96630
|
});
|
|
96612
96631
|
}
|
|
96613
96632
|
}
|
|
96614
96633
|
});
|
|
96634
|
+
// Output the markdown table node
|
|
96615
96635
|
const firstRow = children[0];
|
|
96616
96636
|
const columnCount = firstRow?.children?.length || 0;
|
|
96617
96637
|
const alignArray = align && columnCount > 0
|