Repository navigation
feat: render LaTeX math in Markdown docs - #218
Conversation
Docs typeset `$…$`, `$$…$$`, and ```math fences as MathML while parsing, through comark-ui's comark-mathml, which now keeps its formulas through Drop's security allowlist and lints display math clean (onmax/comark-ui#449). A doc without math loads nothing for it, and Copy as Markdown keeps the LaTeX. Comments work on and around formulas: a quote's anchor skips text that isn't drawn (an inline block's <style>, a formula's TeX annotation) and matches a formula as a selection quotes it, with its symbols spaced and in their italic forms. A bubble at a quote's end inside a formula sits right after its <math>, beside a display formula. The comark-ui update leaves Kroki fences as code unless drawing is on, so Drop turns it on, as before. The render cache revision goes up so existing docs render their math. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Latest result Pull request merged. Final answersSession Pull request merged. Session Merged 7cd03b9 directly: required checks passed and review threads were resolved. No repair needed: prior findings are fixed, threads resolved, and hosted checks green. Local lint and three math tests passed; two browser tests could not launch because Chromium is absent. Upstream prerequisite remains unverified because github.com DNS resolution failed. Session Pull request evidence changed. Session Waiting for review checks before the next pass. |
There was a problem hiding this comment.
Important
Formula comments can attach to unrelated prose, and formulas with phantom spacing leave their comments unplaced.
Reviewed changes — Reviewed the math-rendering dependency update, cache invalidation, comment anchoring, documentation, and regression coverage.
- Math rendering: Updates the Comark packages to the build that preserves server-rendered MathML through sanitization and accepts display math when publishing.
- Rendering compatibility: Explicitly retains Kroki diagrams and invalidates existing Markdown renders with
drop.23. - Formula comments: Filters non-rendered text, adds normalized quote matching, and places comment bubbles and suggestions outside MathML.
- Documentation and validation: Documents the supported math syntax and adds render/lint/browser coverage; 46 focused tests, changed-file lint, Nuxt typecheck, and the Doctor gate passed.
gpt-6.1-sol(xhigh) | 𝕏
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…st invisible MathML A quote matched in plain form (NFKC) only lands where its formula-only characters, such as 𝑘, fall in a formula, so a comment on the k of $k$ no longer moves to the k of "stock" before it. Text under <mphantom>, which a selection never quotes, is skipped like <annotation>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Important
The new formula-only check also rejects ordinary Unicode prose in selections spanning math, leaving those comments unplaced.
Reviewed changes — Reviewed the dependency refresh and comment-anchor fixes added since the previous Pullfrog review.
- Updated Comark dependencies to build
c883574, including corrected entity escaping, formula-reference parsing, and case-insensitive component detection. - Restricted Normalized quote matches so rendered mathematical glyphs cannot match earlier prose, and added the
stock/$k$browser regression. - Excluded Phantom MathML text from quote lookup and extended browser coverage with
$x\phantom{ABC}+y$.
Validated both previous fixes and resolved their threads. All 47 existing focused tests passed, along with changed-file lint, Nuxt typecheck, and Doctor; an additional Chromium round-trip reproduction confirmed the new defect inline.
gpt-6.1-sol(xhigh) | 𝕏
There was a problem hiding this comment.
ℹ️ No P0 or P1 findings remain; one P2 quote-restoration regression is noted inline.
Reviewed changes — Reviewed the dependency refresh and comment-anchoring fixes since cb6a6e4.
- Updated Comark packages: Moved to
c883574, including fixes for literal entity escaping, formula references, and cased component linting. - Restricted normalized matches: Required compatibility-transformed quote characters to match inside MathML, preventing the reported formula-letter collision with prose.
- Excluded phantom text: Removed invisible
mphantomcontent from quote matching and expanded the browser regression. - Validated behavior: Passed 46 focused tests, changed-file lint, Nuxt typecheck, and Doctor; independently checked runtime-reported selections and restored DOM ranges.
gpt-6.1-sol(xhigh) | 𝕏
There was a problem hiding this comment.
✅ No new issues found; no P0 or P1 findings remain.
Reviewed changes — Reviewed the quote-restoration fix and browser regressions added since 9003b73.
- Preserved prose compatibility characters: Allowed normalized matches to retain identical original prose characters while keeping transformed formula letters off ordinary prose.
- Added selection round-trip coverage: Verified runtime-reported quotes containing
µ,², andfirestore to the correct paragraph, alongside the existing formula-letter and phantom-spacing regressions.
All 47 focused tests passed, including the reviewed-site popover and HTML-frame tooltip suites; changed-file lint, Nuxt typecheck, and Doctor also passed.
gpt-6.1-sol(xhigh) | 𝕏

A doc with math shows every formula as its TeX in monospace, and Drop refuses to publish it once it has a
$$block (::comark-mathml-2` is not a known component). The economics paper we published from a PDF had to turn every equation into a PNG because of this.The parsing was already there: comark-ui's
comark-mathmltypesets$…$,$$…$$and```mathfences to MathML on the server. Two bugs in comark-ui broke it under Drop's setup:securitystripped the MathML, and the linter rejected display math. onmax/comark-ui#449 fixes both, and this PR moves Drop onto that PR's latest build. MathML needs no script, font or stylesheet in the browser, and the server imports Temml only for a doc that has a formula. "Copy as Markdown" already returns the source, so it keeps the LaTeX.Comments needed three fixes in
shared/plan-runtime.ts:<style>comark-mathml puts before the first formula, and each formula's TeX<annotation>. Before this, a comment whose quote crossed the first formula never found its text.<mphantom>.kas the italic𝑘. A quote that doesn't match exactly is matched again without whitespace and in NFKC form, and a character only a formula draws that way has to land inside a formula, so a comment on the formula's 𝑘 can't move to the k of "stock".<math>, which can't hold HTML. A display formula's bubble sits beside it.The comark-ui update also brings #447, which leaves Kroki fences as code unless drawing is on, so the preset passes
diagrams: trueto keep drawing them. The render cache goes todrop.23so existing docs re-render with their math. The Markdown reference documents math, and math comes off the "What Drop doesn't render" table.Evidence: https://drop.vitehub.dev/d/ytyz8f3ce9sw/before-after
test/skills/math.test.mjs(render, lint, a doc without math) andtest/viewer/math-comments-browser.test.mjsfail without this change. The browser test also fails with onlyplan-runtime.tsreverted. Typecheck, lint and doctor pass. The four review and viewer browser tests that fail on this branch (marker, highlight, dock overflow, send) fail onmainthe same way on my machine.The live editor keeps inline math and
mathfences. A doc with a$$block stays read-only there, as onmain, since the editor doesn't save it back unchanged.Depends on onmax/comark-ui#449:
package.jsonpoints at its pkg.pr.new build, and moves to the release once it's merged.🤖 Generated with Claude Code