GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(app): render \[...\] LaTeX display math delimiters by simonechecchia · Pull Request #35951 · anomalyco/opencode

Conversation

@simonechecchia

@simonechecchia simonechecchia commented Jul 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #24426

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Model output often uses \(...\) / \[...\] for LaTeX math instead of $...$ / $$...$$. Inline \(...\) was already handled by the existing katex tokenizer, but \[...\] was not, so it fell through to CommonMark's backslash-escape rule (which strips \[ and \] to plain [/]) and rendered as mangled text instead of math.

I added a \[...\] block-math path alongside the existing $$...$$ one, in both places math is currently handled:

  • the marked tokenizer extension (blockKatex), used for the main JS render path
  • the native-parser HTML post-processing fallback (renderMathInText)

Code fences and inline code spans are left untouched in both paths (verified in tests).

How did you verify your code works?

Added unit tests in packages/ui/src/context/marked.test.ts covering:

  • inline \(...\) and display \[...\] / $$...$$ math on both render paths
  • fenced code blocks containing \[...\]-like text are not touched
  • a markdown table with math in cells (the exact shape that triggers CommonMark's backslash-escape stripping)

Ran bun test (all passing) and bun run typecheck (clean) in packages/ui.

Screenshots / recordings

Not a UI change (no new components/styles), just extends the existing katex delimiter handling in packages/ui/src/context/marked.tsx.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

1024th reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@simonechecchia
fix(app): render \[...\] LaTeX display math delimiters
360b755
Fixes anomalyco#24426
Copilot AI review requested due to automatic review settings July 8, 2026 19:10
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 8, 2026
Copilot started reviewing on behalf of simonechecchia July 8, 2026 19:11
View session
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Related PR Found

PR #34642: fix(ui): fallback math rendering for multiline $$ blocks

  • fix(ui): fallback math rendering for multiline $$ blocks #34642

Why it's related: This PR addresses similar math rendering issues. PR #35951 (current) adds support for \[...\] display math delimiters alongside the existing $$...$$ path. PR #34642 appears to handle fallback math rendering for $$ blocks. Both PRs are improving LaTeX math rendering in the app's UI, specifically in the marked tokenizer and HTML post-processing. You should verify whether #34642 already addresses the \[...\] case or if it's complementary work.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot AI reviewed Jul 8, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes LaTeX display-math rendering for \[...\] delimiters in the UI markdown pipeline, aligning with common model output conventions and preventing CommonMark backslash-escape from mangling intended math blocks.

Changes:

  • Extend math rendering to treat \[...\] as display math alongside existing $$...$$ support.
  • Update the Marked tokenizer extension to recognize \[...\] as a block KaTeX token.
  • Add unit tests covering both render paths, code-fence non-interference, and the reported issue repro.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/ui/src/context/marked.tsx Adds \[...\] display-math handling in both the HTML post-processing renderer and the Marked block tokenizer path.
packages/ui/src/context/marked.test.ts Adds coverage for inline + display math across both parsing paths, including code-fence safety and issue repro.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@simonechecchia
Merge branch 'dev' into fix/latex-bracket-delimiters
27e8095
This was referenced Jul 24, 2026
fix(ui): support single-line and bracketed display math #38689
Closed
fix(ui) latex dollar render #38829
Closed
@github-actions github-actions Bot mentioned this pull request Aug 6, 2026
feat: render single-dollar and inline double-dollar LaTeX math with KaTeX #40878
Closed
3 tasks done
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Aug 8, 2026
@github-actions github-actions Bot added the automated-pr-cleanup label Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

automated-pr-cleanup

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Laxtex rendering in opencode web ui

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@simonechecchia
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.