Repository navigation
Typeset the TeX the dependency explorer draws - #455
Conversation
The explorer asked MathJax to typeset its rail and details through MathJax.typesetPromise, which reads MathJax's startup document. The site's javascripts/mathjax.js gives that document a TeX input that finds nothing and typesets only the formulas the site marks, so the explorer's titles and summaries stayed raw TeX on every site. The browser test stubbed MathJax, so it could not see this. The explorer now marks the authored titles and summaries in its rail and details with the site's formula class and, after each render, dispatches an autoform:typeset event. mathjax.js answers it with its own pass, so the explorer's TeX gets the articles' input, packages, macros and safe options. Before MathJax starts the event is ignored, and the first pass reads the marks. The Node suite checks the pass against MathJax itself, and the browser test now serves MathJax 3.2.2 from the checked tarball and looks for typeset output.
MathJax keeps a document's math in a linked list, which has no length, so the browser test read None; it reads the list through Array.from, as the Node test does.
…order Every pass reset MathJax's output, and CHTML's style sheet holds only the glyphs drawn since its last reset, so each pass the explorer asked for dropped the rules that draw the formulas already on the page: a pass that found nothing blanked them all. Only a pass for a page just shown resets the output now; the explorer's passes add to the page. MathJax's menu gave each formula a tab stop, a context menu and a Space key of its own, inside the rail's links, the relation buttons and the sheet handle. A formula inside a link or a button is now typeset in a document without the menu, with the same page input. The sheet handle carries the formula class only while it shows a node's title; the landing page's title it shows otherwise is printed as typed.
The README said the explorer shows titles as typed and that the articles' input reads only the Markdown's formulas; it now names the explorer's typeset titles and summaries and the formulas in links and buttons, which get no menu. The changelog gains a line.
|
Review of #455 at 20f55c6: fix before merge. The explorer's titles and summaries are typeset with the same safe settings as articles, and its passes queue correctly. But three of the controls it marks still give their formulas MathJax's menu, which the code comment and the README say cannot happen. Blocks merge
Note
Checked and fine
Posted by jackmccarthy-77, the reviewer the lead assigned. |
The check for a formula in a link or a button began at the marked element's parent, so formulas marked on the control itself, the relation buttons and the sheet handle, still got MathJax's menu and a tab stop, as did the trail's entries, whose class was on the list item around the link. The check now begins at the marked element, and the trail puts the class on its link. The Node test marks a trail link, the handle and a relation button, and the browser test checks those, with the rail rows, hold no tab stop. Reviewed by jackmccarthy-77.
A reader can turn on MathJax's accessibility explorer from the menu of any formula, and the setting holds for every page of the site. It then gave each formula in a rail link, the trail, a relation row or the sheet handle a tab stop at tabindex 1, ahead of the page, and took the Enter key from its control, because the explorer attaches before the menu would reset the tab stop, and the document for those formulas has no menu. That document now turns the explorer's render action off too. A browser test turns the setting on and checks that those controls hold no tab stop or application role while the rail's title, outside any control, becomes one. Also from the final pass: the browser test asks for the MathJax package without needing Node, which a Playwright container may lack; a typeset formula keeps its letters' case under the rail's group headings, which are set in capitals; and the docs name the Contents list among the places that show titles as typed.
One conflict, in CONTRIBUTING.md: #424 condensed the CI paragraph, and this branch's sentence on the WebKit job's MathJax tarball moves into its wording.
|
Final pass on #455: merge. The pass ran at How it was checkedFour reviewers, a skeptic per finding, and a judge, all at
The one fix before mergeWith MathJax's accessibility explorer on, formulas in controls became tab stops that took Enter. A reader can turn the explorer on from any formula's menu (Accessibility > Activate), and the setting holds for every page of the site. With it on, each formula in a rail link, a trail link, a relation row or the sheet handle got
Also in
|
Conflicts in autoform_cli/README.md and CONTRIBUTING.md, where #458 cut and condensed the docs. Both take main's text, with this branch's facts in its wording and within its line budgets: the explorer typesets its rail's and details' titles and summaries, formulas in links and buttons get no MathJax tab stop or menu, and CI's WebKit job unpacks the MathJax package too.
|
Second round on #455 at dad0dce: the blocker is fixed, and nothing blocks merge.
Posted by jackmccarthy-77. |
|
Head check at a8e753f (merge of main 7677dbf, #458): nothing blocks merge. Eight of the PR's ten files are unchanged line for line from the round at dad0dce, and the two conflicts were resolved keeping both sides.
CI is green at a8e753f, 9 of 9: https://github.com/facebookresearch/autoform-bot/actions/runs/40060027990 Posted by PR swarm: PR Swarm Lead |
#455 added a pinned MathJax download step to the WebKit job, after the install step this branch removes. The resolution, as agreed on #456: keep the Playwright 1.62.0 image and its bash default, drop the install step, and keep #455's checksummed MathJax step, its AUTOFORM_MATHJAX_DIR export and its AUTOFORM_REQUIRE_MATHJAX_TESTS variable.
The dependency explorer's TeX is never typeset on a real site. Its rail and details show
$\mathbb{Z}/n$as typed, on main.Why
#90 (4f14924, merged 2026-10-21) made the explorer call
MathJax.typesetClearandMathJax.typesetPromiseon its rail and its details after each render. That reads MathJax's startup document. #215 (35a81f0, merged 2026-10-20) made the site's generatedjavascripts/mathjax.jsgive that document a TeX input with no delimiters, and typeset only the formulas the site's Markdown marks with its formula class, through passes of its own. So the explorer's calls resolve and find nothing. 4f14924 was written against the earlier vault template, whose startup typeset the page; the browser test replaced MathJax with a stub that recorded the calls, so it could not see that nothing was typeset.Reproduced twice before the fix: in Node with MathJax 3.2.2 on the generated script (rail 0, details 0 typeset formulas, where 4 and 7 were expected), and on sites built from main (before and after #284) loaded in jsdom with the page's own scripts in order (Material,
javascripts/mathjax.js, MathJax's browser bundle served from the npm package, the explorer). Both typeset the explorer when given the old template, so the harnesses detect typesetting.What changes
dag_viewer.py. The explorer marks the authored titles and summaries it draws in its rail and details with the site's formula class (markdown.FORMULA_CLASS, substituted into the script): the rail's trail, title, summary, group headings and rows, and the details' kicker, title, summary, relation rows and distribution labels, and the phone sheet's handle while it repeats a node's title (the landing page's title it shows otherwise is printed as typed). Map cards, search results and the explorer's head stay as they were. After each render,typeset()dispatches anautoform:typesetevent instead of calling MathJax, and the explorer no longer readswindow.MathJax. No div is marked, since the site stylesdiv.arithmatex. The runtime goes from 64,262 to 64,222 bytes of its 66,000. A typeset formula keeps its letters' case under the rail's group headings, which are set in capitals.mathjax.py. The generated script answersautoform:typesetwith its own pass: a new page input with its packages and the project's macros, the safe options, one finished document per step, in the queue of passes. The event carries nothing, so the explorer cannot choose other settings. Before MathJax has started, the event is ignored, and the first pass reads the marks. Two things a pass did once per page now depend on what it is for:It adds no command, flag, JSON key or schema; the one new name is the internal event
autoform:typeset.Tests
tests/test_site_mathjax_node.py: MathJax itself, on the script render writes. After the page's pass, explorer-like content is drawn into the page, marked and unmarked, and the explorer's event asks for a pass. Only the marked formulas are typeset, with the page's packages and the project's macros; a formula in a link gets a document of its own; every glyph on the page keeps its rule in the renderer's style sheet; MathJax's startup document stays empty; an event before MathJax starts does nothing. Removing the listener, itsstartedguard,started = true, the link's own document, or resetting the output on the explorer's passes fails it.tests/test_dag_viewer_browser.py: the explorer's typesetting test no longer stubs MathJax. It serves MathJax 3.2.2 from the checked tarball in place of the CDN, gives the payload TeX titles and summaries, and asserts typeset output in the rail's title, summary and rows, in the details' title and summary, in the phone sheet's handle, and in a relation row that Show more appends; that the rail's glyphs keep their drawing rules after the details' pass; that a formula in a rail link is no tab stop while the rail's title keeps MathJax's menu; none in map cards; and an empty startup document.tests/test_graph_view_rendering.py: pins the event, the class, the three call sites, and that the script no longer readswindow.MathJax.AUTOFORM_MATHJAX_DIR, withAUTOFORM_REQUIRE_MATHJAX_TESTS=1).CONTRIBUTING.mdsays so.Before pushing, the fixed site was also checked in the jsdom harness above: rail 5 and details 3 typeset formulas, 5 after a node is selected, with the explorer drawn before MathJax starts, after it, and with nothing delayed; MathJax's startup document stays empty.
Overlap with other open pull requests
autoform_cli/dag_viewer.py,autoform_cli/mathjax.py,autoform_cli/README.md,.github/workflows/tests.yml,CONTRIBUTING.md,tests/test_dag_viewer_browser.py,tests/test_graph_view_rendering.pyandtests/test_site_mathjax_node.py. At its head the explorer typesets through awindow.AutoformMath.refresh(container)hook that Integrate mathematical book reading and dependency exploration #442'smathjax.jsdefines, not through this PR'sautoform:typesetevent. The interface of whichever lands first stays, and the second moves its explorer onto it and carries the rest: the explorer's titles and summaries get the articles' input and the project's macros; a pass that adds to a page does not reset MathJax's output, which would blank the formulas already drawn; formulas in links and buttons, or marked on one, get neither MathJax's menu nor its accessibility explorer; and the Node test, the real-MathJax browser tests and the WebKit job's MathJax step come along.tests/test_dag_viewer_browser.pyandtests/test_graph_view_rendering.py.tests.yml: keep the container and itsdefaults: run: shell: bash(the MathJax step usesset -euo pipefail), drop the install step, and keep this PR's MathJax step andAUTOFORM_REQUIRE_MATHJAX_TESTS. The container has no Node, so the browser test asks for the MathJax package without it (mathjax_package(node=False)).Review
An adversarial review of
dfdaf404(three reviewers, each finding checked by a skeptic) confirmed the reset that blanked earlier formulas and the tab stops inside controls, both fixed in81b67e6dwith the tests above, plus documentation gaps and the sheet handle typesetting the landing page's title, fixed too. Checked again in jsdom with real MathJax after the fix: no glyph on the page loses its rule, with the explorer drawn before or after MathJax starts and after a node is chosen by its link.A second review, by jackmccarthy-77 at
20f55c61(comment), found the menu still on formulas marked on a control itself (the relation buttons and the sheet handle) and on the trail's entries, whose class sat on the list item around the link.fba2802astarts the check at the marked element and puts the trail's class on its link; the Node test marks a trail link, the handle and a relation button, and the browser test checks those, with the rail rows, hold no tab stop.A final pass at
fba2802a(four reviewers, a skeptic per finding, and a judge) recommended fixing one thing before merge: with MathJax's accessibility explorer turned on, formulas in controls still became tab stops at tabindex 1 and took Enter.83005c92turns the explorer's render action off in their document, and a browser test turns the setting on and checks it. The same push decouples the browser test from Node, keeps formulas' letter case under capitalised headings, and names the Contents list in the docs. Its other findings are follow-ups, listed in the verdict comment.jackmccarthy-77's second round, at
dad0dce8, found nothing that blocks merge (comment).Validation
a8e753f4merges main 7677dbf. #458 cut and condensed the docs, soautoform_cli/README.mdandCONTRIBUTING.mdconflicted; both take main's text, with this PR's facts in its wording and within its line budgets (tests/test_doc_budgets.py). All 9 checks pass ona8e753f4, and the branch merges cleanly with main.