Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(Markdown): table alignment and width fixes (#2109)

Cindy Zhang3312f698104d
diff --git a/packages/core/src/Markdown/XDSMarkdown.tsx b/packages/core/src/Markdown/XDSMarkdown.tsx
index 659f7e448a..73aa8b663c 100644
--- a/packages/core/src/Markdown/XDSMarkdown.tsx
+++ b/packages/core/src/Markdown/XDSMarkdown.tsx
@@ -1380,7 +1380,14 @@ function renderBlock(
<div
key={index}
{...stylex.props(
+ styles.tableWrapper,
spacing,
+ contentWidthValue != null
+ ? dynamicStyles.blockWidth(contentWidthValue)
+ : null,
+ BLOCK_ALIGN_MARGIN[contentAlign] != null
+ ? dynamicStyles.blockAlign(BLOCK_ALIGN_MARGIN[contentAlign]!)
+ : null,
isFirst && styles.noMarginBlockStart,
isLast && styles.noMarginBlockEnd,
)}>
@@ -1390,11 +1397,11 @@ function renderBlock(
{node.headers.map((h, i) => (
<XDSTableHeaderCell
key={i}
- {...stylex.props(
+ xstyle={[
dynamicStyles.cellMinWidth(`${colMinWidths[i]}px`),
node.alignments[i] === 'center' && cellAlignStyles.center,
node.alignments[i] === 'right' && cellAlignStyles.right,
- )}>
+ ]}>
{h.children.map((c, j) =>
renderInline(c, j, onLinkClick, cursor, citationCtx, linkComponent, inlinePlugins, components),
)}
@@ -1409,10 +1416,10 @@ function renderBlock(
const cells = row.map((cell, j) => (
<XDSTableCell
key={j}
- {...stylex.props(
+ xstyle={[
node.alignments[j] === 'center' && cellAlignStyles.center,
node.alignments[j] === 'right' && cellAlignStyles.right,
- )}>
+ ]}>
{cell.children.map((c, k) =>
renderInline(c, k, onLinkClick, cursor, citationCtx, linkComponent, inlinePlugins, components),
)}