Skip to content

Render agent-style TeX delimiters as math - #261

Draft
richwomanbtc wants to merge 1 commit into
happier-dev:devfrom
richwomanbtc:agent/render-agent-tex-math
Draft

Render agent-style TeX delimiters as math#261
richwomanbtc wants to merge 1 commit into
happier-dev:devfrom
richwomanbtc:agent/render-agent-tex-math

Conversation

@richwomanbtc

@richwomanbtc richwomanbtc commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • normalize agent-style \(...\) and standalone \[...\] delimiters into the enriched renderer's supported math syntax
  • keep code, links, URLs, escaped delimiters, incomplete streaming input, and existing dollar math unchanged
  • render math inside Markdown table cells while preserving horizontal scrolling and column alignment

Root cause

The enriched Markdown renderer already enables MD4C's LaTeX math extension, but that parser recognizes $...$ and $$...$$, while coding agents commonly emit \(...\) and \[...\]. Those delimiters therefore remained literal. Tables also use the legacy block renderer, so math cells needed an explicit path into the enriched renderer.

Validation

  • 36/36 focused math and table tests passed on this math-only branch
  • git diff --check upstream/dev...agent/render-agent-tex-math passed
  • UI typecheck passed earlier on the original clean validation commit containing these exact math files
  • the isolated math-only typecheck rerun did not reach the UI compiler because the temporary worktree's workspace-package prebuild could not resolve its symlinked zod dependency

Draft status

iPhone live rendering is not yet verified. The local development client was installed and reached the native bundle path, but the shared QA server could not safely complete the first Metro bundle under its memory constraints. This remains an explicit live-QA gap rather than a passing result.

Fixes #257
Related: slopus/happy#1629


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Note

Render agent-style TeX math delimiters (\(...\) and \[...\]) in markdown

  • Adds normalizeEnrichedMarkdownMathDelimiters to convert Codex-style \(...\)/\[...\] delimiters to $/$$ before passing markdown to the enriched renderer, skipping protected regions like code spans, links, and URLs.
  • Table cells now conditionally render via EnrichedMarkdownTextAdapter (using the new RenderTableCellContent helper) when math is detected, falling back to plain Text otherwise.
  • EnrichedMarkdownTextAdapter gains a fillContainer prop to suppress full-width stretching in table cell contexts, and math/paragraph alignment now respects the incoming textStyle.textAlign.
  • Behavioral Change: table cells containing math are now rendered by the enriched markdown pipeline instead of plain text, which changes their visual appearance and adds a dependency on the profile prop in MarkdownBlockView.

Macroscope summarized f63eb67.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 57a03fe1-d81f-4e42-8373-0d7eb682b9a8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown: render agent-style TeX delimiters as math

1 participant