Skip to content

fix(fields): a markdown heading in a list cell draws at the cell's text size - #36428

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-36344-markdown-cell-heading
Nov 22, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-36344-markdown-cell-heading

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #36344

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户在列表里看到的变化:含 Markdown 字段的列表单元格,内容以标题开头时不再以大标题字号显示、也不再把这一行撑高,行高与其他行一致;记录详情页仍按原样显示大标题。
  • 为什么做:列表视图体验修复,替在列表中显示富文本列的用户解决「标题被截断、行变高」的问题。
  • 出错会怎样:最坏情况是列表里 Markdown 单元格的样式不对(只影响显示,不影响数据),可以直接撤回本次改动。
  • 要你做什么:无。

What changes

  • @object-ui/fields MarkdownContent gains a face prop: document (the default, unchanged) and cell. The cell face draws every heading level as a p.font-semibold (no heading element) and the body takes the surrounding cell's font size and line height (text-[length:inherit] leading-[inherit] on top of the same prose prose-sm typography).
  • MarkdownCellRenderer picks the cell face when inGridColumn is set. ObjectGrid already passes inGridColumn on every column cell, and RelatedList on every table cell, so no host changes. The record page, readonly form fields and every other caller pass nothing and keep the document face with its heading sizes.
  • CellRendererProps.inGridColumn JSDoc now names the markdown cell as its second reader.
  • Changeset: @object-ui/fields patch.

Read first (by risk):

  1. ui/packages/fields/src/widgets/MarkdownContent.tsx — the cell face: CELL_COMPONENTS (heading levels mapped to a paragraph) and MARKDOWN_CELL_FACE_CLASS. Sanitisation is unchanged: the same rehype-sanitize schema runs in both faces; the component map only renames the element of a node the sanitiser already passed.
  2. ui/packages/fields/src/widgets/richTextDisplay.tsx — the one line that chooses the face from inGridColumn.
  3. ui/packages/fields/src/__tests__/markdownCellHeading-36344.test.tsx — the pins and the record-page control.

Two-minute check: pnpm --dir ui exec vitest run packages/fields/src/__tests__/markdownCellHeading-36344.test.tsx packages/plugin-grid/src/__tests__/ObjectGrid.richTextOneLine-12480.test.tsx from the repository root — expect 2 files, 8 tests passed.

Tests

  • New ui/packages/fields/src/__tests__/markdownCellHeading-36344.test.tsx (3 cases): in a grid column, a # Heading value draws no h1-h6, the heading is a p.font-semibold, the body carries the two inherit classes and stays formatted; all six heading levels are drawn the same way; CONTROL — without inGridColumn (the record page path) the h1 stays and the inherit classes are absent.
  • New top-level describe in ui/packages/plugin-grid/src/__tests__/ObjectGrid.richTextOneLine-12480.test.tsx (the existing one-line-clamp harness): through the real ObjectGrid, the markdown cell inside the clamp is the cell face and tbody holds no heading element. This is the row-height contract the grid relies on (one line inside line-clamp-1, at the cell's line height).
  • The existing readonly form pin (readonly-richtext-display-5498.test.tsx, a readonly markdown field keeps its h1) stays green: full-size displays keep their heading elements.
Ablation (one, the behaviour the pins hold)

The fix committed first; mutation through scripts/ablation-replace.mjs on richTextDisplay.tsx, anchor face={inGridColumn ? 'cell' : 'document'} replaced by face={'document'} (anchor x1 to x0, blob c327713e to a365cf70). No build step: vitest resolves @object-ui/fields to src through ui/vitest.config.mts's alias.

  • Mutated: Test Files 2 failed | 1 passed (3), Tests 3 failed | 5 passed (8). The three cell-face cases went red (AssertionError: expected an empty h1 element to be null), the record-page control and the original objectui#12480 cases stayed green.
  • Restored: blob after restore c327713e == blob at HEAD, git diff HEAD empty.
Pixel reading (Chromium, not the live app)

Harness: the DOM of a real ObjectGrid render (jsdom, 4 rows: plain text, # Heading + paragraph, **bold** and _em_, ## Second level) and of the record-page MarkdownCellRenderer, laid into a page with the Console's own stylesheet compiled from ui/apps/console/src/index.css (Tailwind 4 + typography), opened in Chromium at 1280 px. A temporary dump test, not committed.

row before (ablated) after
plain text 36 px 36 px
# Heading + paragraph 45 px (H1 30px / 36px line) 36 px (P 14px / 17.5px line)
**bold** and _em_ 36 px 36 px
## Second level 36.5 px (H2 20px / 28px line) 36 px
record page h1 30 px 30 px

The 36 to 45 px reading matches the card's. NOT MEASURED in the running Console against a backend (the harness uses the real component DOM and the real stylesheet, but no live list page).

Acceptance notes

Verification

All readings on head e241a872 (branch merged with origin/main at 97b9d1e before the runs), each under scripts/pm/os-verify-lock.sh, unless noted.

Tests
  • pnpm --dir ui exec vitest run --maxWorkers=2 over the six rich-text files (the two new pins, readonly-richtext-display-5498, richtext-cell-renderer-5452, cellRenderers.childlessContainer-8580, RelatedList.longFormColumns): Test Files 6 passed (6), Tests 55 passed (55).
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/fields/: Test Files 322 passed | 1 skipped (323), Tests 4846 passed | 7 skipped (4853).
  • pnpm --filter @object-ui/fields run type-check exit 0; pnpm --filter @object-ui/plugin-grid run type-check exit 0 (both run tsc --noEmit && tsc -p tsconfig.test.json, after building the @object-ui/plugin-grid dependency closure).
  • The ablation above ran on 919a2f4f, the commit before the origin/main merge; the merge brought no change to the files it reads.
Gates
  • node scripts/pm/dispatch-gates.mjs --commands (no paths): 39 families for the 6 changed paths. All 39 run, each exit 0, including pnpm --dir ui exec vitest run scripts/ (Test Files 172 passed | 2 skipped (174)). pnpm check:type-check-debt answered exit 3 (PREREQUISITE NOT MET, no built closure) in the first sweep and exit 0 on the re-run (check-type-check-coverage --re-measure: OK).
  • --ran reconciliation: 39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED (a DERIVED zero — all 39 recorded an exit code and none of them is 3).
  • node scripts/pm/overlap-check.mjs: VERDICT clean exit 0 (origin/main merges cleanly; 0 open PR heads share a file).
  • Repo-wide families (lint, the full UI test shards, dogfood) are CI's.

Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jUc3qp6bHKSWijbjds

Final head (area f7-list, 2026-11-22T11:52Z): e241a87283718ece6d6e94d45e95198c25f00ab4 — CI on it: 44 success, 13 skipped, 0 failed. Clause-②: no — MarkdownContent's new face prop is not on an entry export (ui/packages/fields/src/index.tsx changes a JSDoc line only). No contract face ⇒ L1 only; 199 changed lines, over the self-review size, so L1 requested from L1-d via seat repo:objectstack#7. Dev report 7078418428 (pixel reading 45 → 36 px in Chromium on the real grid DOM; record page keeps its h1).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jS7jCv5PH4ytECQWqf

L1 ACCEPT · head e241a87283718ece6d6e94d45e95198c25f00ab4 · 2026-11-22T11:56Z

维护者速读

席位核对

  • 形态:draft、base main、Fixes #36344;NOT governed;6 个文件,192 行。Fixes 能成立:卡上三项都做到了:列表格子里的标题用单元格自己的字号;有渲染器的钉子,配了一条消融;记录页保留标题大小(有 CONTROL 用例)。
  • changeset:l1-face 标了 @object-ui/plugin-grid 没有条目。那个包里这次只改了一个测试文件(ObjectGrid.richTextOneLine-12480.test.tsx),它的 files 只发布 dist,所以不用加(和之前「测试文件不需要 changeset」的先例一致)。@object-ui/fields 有 patch 条目。改动里包根导出的 CellRendererProps.inGridColumn 的 TSDoc 会进 .d.ts,这个条目已经覆盖了它。
  • 声明:Clause-②: no 属实。MarkdownContent 新加了可选的 face 属性,MarkdownFace 和 MARKDOWN_CELL_FACE_CLASS 也只从 widgets/MarkdownContent.tsx 导出,包根(index.tsx)没有转出它们,所以公开面没有扩大。changeset 里「no export changes」这句也就属实。Metadata-protocol: none 属实。
  • 代码:MarkdownCellRenderer 只在 inGridColumn 时用 cell 这张脸。会传 inGridColumn 的是 objectGridGenerateColumns.tsx 里画单元格的每一处,以及 RelatedList.tsx:2934,和 changeset 里「list views and related lists」的说法对得上。cell 这张脸把 h1 到 h6 都换成 p.font-semibold,只改元素,不碰内容,rehypeSanitize 还在同一条管线里。字号和行高通过 text-[length:inherit] leading-[inherit] 跟着单元格走。顺带的好处是:每一行不会再往页面的标题大纲里加一个条目。
  • 文本逐句核:changeset 和两处 TSDoc 都与 diff 一致。「row keeps the height」这句有正文里的实测表支撑(用真实组件 DOM 加 Console 自己的样式表,在 Chromium 1280 px 下量)。它没有在连着后端、真正跑起来的列表页上量过,正文写明了。
  • 测试证据:fields 层 3 条:cell 脸没有标题元素、标题变粗体、正文继承单元格字号;六级标题都同样处理;记录页 CONTROL 保留 h1。plugin-grid 层 1 条:走真实的 ObjectGrid,一行显示的裁切里没有任何标题元素。消融把 face={inGridColumn ? 'cell' : 'document'} 换成 'document',这几条钉子随之挂掉,换回后恢复。
  • nit,不改判:MARKDOWN_CELL_FACE_CLASS 导出了,但仓库里没有别的地方用它,可以不导出。
  • 范围外候选:正文记了一条观察:html / richtext 的单元格(HtmlCellRenderer)在格子里仍然保留标题元素,存进去的 <h1> 应该也会撑高这一行。这条只是从代码读出来的,没有实测。要不要立卡,由席位决定。
  • CI @ e241a872:44 success · 13 expected skip · 0 failed · 0 pending。
  • 落地条款:非受管,只做 L1,所以 f7-list 凭本 ACCEPT 走 ready + auto-merge。

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jUc3qp6bHKSWijbjds

Landing (area f7-list, 2026-11-22T12:00Z): head e241a87283718ece6d6e94d45e95198c25f00ab4 · L1 ACCEPT 7078774345 (L1-d; no L2 owed: Clause-②: no, no contract face) · check-governed-merges --pr 36428: NOT governed, 199 changed lines ≤ 3000 · CI on the head: all success/skipped, 0 failed · mergeable clean. → pr_ready + automerge_enable (merge queue). Carried, not filed: the html/richtext cell (HtmlCellRenderer) may grow rows on a stored h1 the same way (read from code only; Acceptance notes).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 22, 2026 12:01
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit 24366ff Nov 22, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-36344-markdown-cell-heading branch November 22, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List cell: a markdown value starting with a heading draws at heading size in the cell (truncated, and the row grows from 36 to 45 px)

2 participants