Skip to content

fix(math): keep brackets an editor escaped as text - #480

Merged
vite-hub[bot] merged 1 commit into
mainfrom
fix/mathml-escaped-brackets
Nov 22, 2026
Merged

vite-hub[bot] merged 1 commit into
mainfrom
fix/mathml-escaped-brackets

Conversation

@onmax

@onmax onmax commented Nov 22, 2026

Copy link
Copy Markdown
Owner

In Drop, a GitHub alert turned into a display formula after someone edited the page. @tiptap/markdown escapes every bracket in text, so it writes > [!NOTE] back as > \[!NOTE\]. GitHub and comark-github still read that as an alert, but comark-mathml read \[!NOTE\] as \[…\] display math, so the quote rendered !NOTE as a formula. The same happened to \[draft\], \[^1\] and a \[x\] done task line.

comark-mathml's \[ rule only left citations like \[1\] as text. This PR also leaves these as text, inline and as a block:

  • an alert marker: \[!NOTE\], \[!TIP\] and the rest
  • a footnote reference: \[^1\]
  • words: \[draft\], \[see below\]
  • \[x\] or \[X\] at the start of a paragraph, which is a task box

\[x\] anywhere else, and anything with TeX in it, is still a formula, so the existing \[d\] tests don't change.

The new test in math.test.ts fails on main (expected [ '$$!NOTE$$', '$$draft$$', … ] to deeply equal []) and passes here. I also parsed one document with the playground's plugins:

main this PR
> \[!NOTE\] blockquote with a formula github-callout
formulas 6 1 (\alpha + \beta)

Open it in the playground. It runs main until this is released, so it shows the formulas for now. pnpm ready passes.

Related: vite-hub/vitehub#3956 added a workaround that rewrites > \[!NOTE\] after Tiptap renders it. That can go once Drop has this. Tiptap escapes brackets on purpose (ueberdosis/tiptap#7898).

@tiptap/markdown escapes every bracket in text, so it writes `> [!NOTE]` back as `> \[!NOTE\]`, and comark-mathml read that as display math. A GitHub alert marker, a footnote reference, words, and a leading `\[x\] ` task box now stay text, as citations already did.
@pullfrog

pullfrog Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

This run was cancelled before it finished.

Pullfrog  | View workflow run | via Pullfrog

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-22T15:20:04.182526Z
We couldn’t complete this review. Comment @codex review to try again.
93ac63f PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@vite-hub
vite-hub Bot merged commit 70bc046 into main Nov 22, 2026
2 of 3 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@vite-hub
vite-hub Bot deleted the fix/mathml-escaped-brackets branch November 22, 2026 15:20
@vite-hub

vite-hub Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

Session

Pull request merged.

@github-actions github-actions Bot mentioned this pull request Nov 22, 2026
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.

1 participant