feat(ios): render native Markdown heading hierarchy#103404
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e8eef750b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .modifier(ChatInlineMathAccessibilityModifier(label: prose.inlineAccessibilityText)) | ||
| case let .heading(level, prose): | ||
| self.proseText(prose, index: index) | ||
| .font(OpenClawChatTypography.heading(level: level)) |
There was a problem hiding this comment.
Preserve thinking-segment typography for headings
When showsAssistantTrace is enabled, thinking segments deliberately pass OpenClawChatTypography.callout.italic() into ChatMarkdownRenderer from ChatMessageViews.swift:920 and ChatMessageViews.swift:1007; this heading path ignores that injected font and always applies large response heading typography. As a result, a visible trace like <think># Plan</think> now renders as a prominent assistant heading instead of the subdued italic thinking style, unlike the pre-change prose path. Please keep heading hierarchy relative to the caller-provided segment typography or pass the segment kind through before overriding it.
Useful? React with 👍 / 👎.
|
Land-ready review completed for exact head What changed:
Proof:
Best-fix verdict: yes. The parser continues to own CommonMark structure and inline semantics; the SwiftUI renderer owns visual hierarchy and accessibility without adding a regex or a second Markdown interpretation path. |
|
Merged via squash.
|
Fixes #98290
What Problem This Solves
Fixes an issue where Markdown headings in native Apple chat rendered at the same visual weight as ordinary paragraph text, so structured responses lost their heading hierarchy. Native table rendering from the same issue already landed in #100207.
Why This Change Was Made
The shared Apple Markdown segmenter now extracts only top-level CommonMark headings as dedicated blocks while preserving their complete ATX or Setext source for the existing Markdown parser. The renderer applies branded H1–H6 Dynamic Type styles and the accessibility header trait, while nested headings remain on the prose path and document-scoped reference links retain the existing whole-document fallback.
This avoids regex-based heading inference, preserves inline emphasis, links, code, and math behavior, and leaves the existing native table path unchanged.
User Impact
iOS and macOS chat responses now show a clear, accessible heading hierarchy that scales with Dynamic Type and remains compatible with inline formatting, streaming updates, containers, reference links, and adjacent tables.
Evidence
6e8eef750b9e2dd2f0dbda0e0e723c8fabd86fed.swiftformat --lint --config config/swiftformat, native i18n, andgit diff --checkpassed after rebasing onto current main.tbx_01kx56fkq9h9pbyk99x9sncw69: remotepnpm check:changedpassed.