Repository navigation
Fix inline MathJax equations losing terms - #71
Merged
Merged
Conversation
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Docs Inline rendering could turn
1+1=2into an image containing only1. MathJax 4.1.2 returns sibling SVG fragments for ungrouped inline expressions, and our shared renderer selected only the first. This PR groups the full colored expression, preserves trailing comments, and rejects unexpected fragments before rasterization. The fix serves Docs and Slides; Sheets remains server-rendered.Human intent
Rephrased from the user's request and material follow-ups:
Screenshots
Actual PNGs produced by the shared renderer in Chromium, shown in a local review gallery. These are not screenshots of the deployed Google Docs/Slides add-on. The images include source hashes and distinguish size Automatic from renderer Automatic.
Docs: Auto and Inline sizes
Slides: Auto and Inline sizes
External renderers: actual service responses
The optional live probe found Sciweavers HTTP 404 in both modes for both examples on September 17. Codecogs and Texrendr returned the complete equations shown. The probe reports this as failure; it neither substitutes MathJax nor marks Sciweavers working.
Test matrix
AlldelimitersThe matrix reads renderer/delimiter options from the shipped sidebar selectors: Automatic, Codecogs, MathJax, Texrendr, Sciweavers;
$$,\[...\],\(...\),$, and All; Automatic/Inline sizes.Allcontains all four delimiter forms in the same paragraph/text box.Browser assertions check every required final glyph, one SVG, no TeX errors, visible PNG ink, compact Inline fractions/sums, and identical PNG hashes across delimiters and Automatic/MathJax preferences. PR CI runs both the Node suite and Chromium suite and uploads fresh screenshots plus per-case JSON evidence.
Reproduction and validation
f1569bc, real MathJax 4.1.2 and production shared renderer. New regression tests originally passed 1/4; Node Inspector confirmed three SVG fragments and first-glyph-only selection. Display mode had one complete SVG.$$/ Inline: 3 SVG fragments instead of 1. The patched renderer passes.npm ci --ignore-scripts, Slides sidebar build, 148/148 Node tests, and browser suite 40 settings / 256 PNG renders.npm run test:matrix,npm run test:render-browser, or optionalnpm run test:render-services.Limits
Apps Script document/slide objects and the final image-insertion boundary are doubled in the settings matrix. Server response fixtures keep deterministic CI independent of third-party availability; the separate live probe checks preferred endpoints, not all fallback routes. Browser tests use the real shared renderer and pixels, but do not prove Google insertion, authorization, deployed versions, or complete render/de-render behavior. The locked font component 4.1.3/core 4.1.2 warning remains documented. No merge, Apps Script push, deployment, or Marketplace release performed.