Skip to content

fix(markdown): a table column that declares :--- says so - #5444

Draft
lexs wants to merge 5 commits into
meta:mainfrom
lexs:md-table-align-left
Draft

lexs wants to merge 5 commits into
meta:mainfrom
lexs:md-table-align-left

Conversation

@lexs

@lexs lexs commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Split out of #5288, where @cixzhang pointed at the bug underneath it.

A column written | :--- | wrote no alignment on a cell that reads in its table's direction, so that cell rendered exactly like an undeclared one. That looks right in isolation, because a cell already starts at the inline start — but text-align inherits, so the column follows whatever the table is nested in. Render a table inside a centered block and a first column that explicitly declares :--- centers itself; nothing in the markdown says it should.

A declared alignment is now always written out, start included. Only the :--- case changes, and only where something around the table had already moved the default — an undeclared column still takes it.

Logical start and end. design:bidirectionality DR3 settles this: start and end alignment follow the containing region's direction. So :--- maps to start and ---: to end, which mirror under right-to-left, the same mapping main uses for the other markers, and the changeset names the start alignment.

Test asserts every declared column's computed alignment on both th and td, and that an undeclared column keeps the table's own default.

Open review requests. This head carries the port onto main (one merge of main, with the Markdown change unchanged). The physical left/right question is governed by design:bidirectionality DR3: start and end alignment follow the containing region's direction, so the logical mapping stands.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 24, 2026
@vercel

vercel Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 21, 2026 3:37pm UTC

Request Review

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Aug 24, 2026
cellAlignStyles had entries for center and end only, so a column written
`| :--- |` got no style at all and rendered exactly like an undeclared one.
That looks right in isolation, because a cell already starts at the inline
start — but text-align inherits, so the column follows whatever the table is
nested in. Rendered inside a centered block, a table whose first column
explicitly declares :--- centers it, and nothing in the markdown says it
should.

A declared alignment is now always written out, start included. Only the :---
case changes, and only where something around the table had already moved the
default.
@lexs
lexs force-pushed the md-table-align-left branch from 83832b0 to c7614ea Compare August 24, 2026 22:07
@lexs lexs changed the title fix(markdown): render a table column on the side its delimiter row declares fix(markdown): a table column that declares :--- says so Aug 24, 2026
@github-actions github-actions Bot removed the needs:design-review Affects visuals — Design should review label Aug 24, 2026
@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

github-actions Bot added a commit that referenced this pull request Aug 24, 2026
github-actions Bot added a commit that referenced this pull request Aug 24, 2026

@rubyycheung rubyycheung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for calling out the RTL judgment explicitly. I checked the behavior against GFM, GitHub’s renderer, remark-gfm, and markdown-it; they all preserve physical left/right alignment under RTL. ASTRYX’s parser also represents these values as left | center | right.

Because this component renders author-specified GFM formatting, translating :--- to logical start and ---: to logical end changes the document’s meaning in RTL. Could we map both values to physical left and right, use a narrowly scoped @astryx/no-physical-properties suppression for this semantic exception, and add RTL coverage?

The logical-property rule makes sense for UI layout, but explicit Markdown alignment is source-document formatting and should remain compatible with the originating syntax.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused fix — writing out a declared :--- alignment so it no longer inherits an ancestor's text-align is the right shape, and the test correctly distinguishes declared from undeclared columns on both header and body cells.

Approval is waiting on one maintainer ruling that this change itself flags: should Markdown table markers preserve GFM's physical semantics (:--- always left, ---: always right, including in RTL), or intentionally map to logical start/end so they mirror in RTL under Astryx styling conventions? A maintainer needs to provide or identify the governing spec for that mapping and settle the RTL behavior. Once that is decided, please align the implementation, add RTL coverage asserting the chosen semantics, and keep the changeset wording consistent with it. No other material defect was found.

[Automated review]

@humbertovirtudes humbertovirtudes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alignment fix at exact head c7614eae is correct in isolation, and its tests cover explicit left, centre, right, and undeclared alignment for headers and cells. The current head cannot land as-is, however: GitHub reports it conflicting with main, and it targets the old node.alignments renderer shape.

Please port the fix onto the canonical Markdown stack after #6675, using node.align, and preserve #6663's single Table-owned scroll viewport, #6664's document grid variant, and #6667's footnoteContext argument in table-cell rendering. The port should keep the logical textAlign: 'start' rule for explicit left alignment and retain the existing assertions.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is right at this revision: a :--- column now keeps its start alignment inside a centered container, default LTR and RTL rendering is unchanged, and the new test fails without the fix. The branch can't merge, though, because it conflicts with main, where the table renderer now reads node.align instead of node.alignments and still lacks the start style. Please rebase onto main, add start to cellAlignStyles and the node.align[i] === 'left' (header) and node.align[j] === 'left' (body) conditions beside the existing entries, and keep your test. Keep the logical start mapping, as the engineering-owner review asked, since it matches the repository's guidance that start/end alignment follows the region's direction; the earlier request for physical left/right stays open for its reviewer to revisit after the port.

[Automated review]

@humbertovirtudes humbertovirtudes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table-scoped review of exact head c7614eae00f85b175090360b4b5319bb762ae334.

The logical-start alignment repair is correct in its own renderer and tests. This head conflicts with current main and uses the old node.alignments representation. Port only this fix to the canonical node.align renderer, retaining current Table scroll ownership and table-cell footnote context, then rerun the alignment cases and applicable browser evidence. This comment does not reverse the existing change request or claim the old head is ready to merge.

# Conflicts:
#	packages/core/src/Markdown/Markdown.test.tsx
#	packages/core/src/Markdown/Markdown.tsx

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. The alignment fix itself is right on this head: a :--- column now keeps its start alignment inside a centered or end-aligned container, every other case renders as before, and the new test fails without the fix.

  • Regression: the changeset's first sentence (.changeset/markdown-table-explicit-left-align.md, lines 7-8) says cellAlignStyles had only center and end and that every :--- column got no style, but main now already has start and already aligns a :--- cell whose text reads against its table, so please reword it to say that only a cell reading in its table's direction was left unstyled.

Optional: the new comment above cellAlignStyles explains the left branch in tableCellSideStyles and would read better there, split into short sentences. The two earlier change requests (the port onto main, which this head carries, and the request for physical left/right alignment) still need their reviewers to re-review or dismiss them, and CI runs once a maintainer adds the ci:run label.

[Automated review]

Comment thread packages/core/src/Markdown/Markdown.tsx Resolved
@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 8, 2026
…sits on its branch

After the merge with main, cellAlignStyles already has start and a cell reading against its table already aligns, so the changeset now says only a cell reading in its table's direction was left unstyled. The comment moves from the style map to the left branch in tableCellSideStyles, in short sentences.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking findings remain at this head: a :--- column now keeps its start alignment inside a centered or end-aligned container, every other case renders as before, the new test fails without the fix, and the changeset now describes main correctly.

Approval waits on the two open change requests: rubyycheung's asks for physical left/right alignment, while this head keeps the logical start/end mapping main already uses for the other markers, and humbertovirtudes's asks for the port onto main, which this head carries. Each reviewer needs to re-review or dismiss their request, or the pull request moves to physical alignment instead.

Optional: the description's first paragraph still says cellAlignStyles had only center and end; if it becomes the merge commit message, reuse the changeset's corrected sentence.

[Automated review]

@cixzhang
cixzhang dismissed humbertovirtudes’s stale review November 8, 2026 19:38

(Posted by Cindy's agent.) Dismissing as addressed at head 2c85d36, with thanks. The fix is now ported onto main's canonical Markdown table renderer (node.align, with main's shared table-cell side styles), keeping Table's scroll ownership and table-cell footnote context. The alignment cases are covered by the new test, which fails without the fix, CI is green at this head, and the latest automated review at this head reports no blocking findings.

@cixzhang
cixzhang dismissed rubyycheung’s stale review November 18, 2026 21:22

(Posted by Cindy's agent.) Dismissed as stale on the owner's decision: this review is on an outdated head. Please re-review the current head if concerns remain.

…t alignment

design:bidirectionality DR3: start and end alignment follow the containing
region's direction, so the file name says start, not left.
@cixzhang
cixzhang marked this pull request as draft November 21, 2026 15:27
@cixzhang cixzhang added the lane:4 Astryx fix-loop lane 4 owns this label Nov 21, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 91908a7

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval is on hold, though nothing in the code needs to change: a :--- column now keeps the table's start inside a centered or end-aligned container, every other case renders as before, and the new test fails without the fix.

  • The change requests from rubyycheung and humbertovirtudes were dismissed by another maintainer rather than by their reviewers, so approval waits on each of them re-reviewing this head.

CI has not run on this head yet because the pull request is still a draft.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Claim (release note): a declared :--- column wrote no alignment on a cell that reads in its table's direction, so it rendered like an undeclared column. Verified: the base cell-style helper returned nothing for that case, and the body cell had no alignment of its own.
  • Claim (release note): because text-align inherits, such a column follows its container and centers inside a centered block. Verified in Chromium for the column's body cells; header cells already set their own start.
  • Claim (release note): every declared alignment is now written out, start included. Verified in Markdown.tsx lines 1379-1385.
  • Claim (release note): only the :--- case changes, and only where something around the table moved the default. Verified: default, right-to-left and against-table renderings are pixel-identical between base and head.
  • Claim (description): the change was split out of #5288, where the underlying bug was pointed out. Verified in #5288's discussion.
  • Claim (description): :--- maps to the start and ---: to the end, mirroring under right-to-left, the same mapping main already uses. Verified in the base and head helper and in right-to-left Hebrew renderings.
  • Claim (description): the changeset names the start alignment. Verified in its file name and text.
  • Claim (description): the test asserts every declared column on header and body cells and that an undeclared column keeps the table's default. Verified: Markdown.test.tsx lines 189-201 fail on the base and pass on the head.
  • File .changeset/markdown-table-explicit-start-align.md: clear.
  • File packages/core/src/Markdown/Markdown.test.tsx: clear.
  • File packages/core/src/Markdown/Markdown.tsx: clear.

Automated review (maintainer link)

This branch was successfully deployed

1 active deployment
Preview — 91908a71 Deployed Nov 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team) lane:4 Astryx fix-loop lane 4 owns this needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants