Skip to content

Render toolbar labels with host MathJax - #41

Merged
nritschel merged 2 commits into
masterfrom
render-mathjax-tool-labels
Nov 3, 2026
Merged

nritschel merged 2 commits into
masterfrom
render-mathjax-tool-labels

Conversation

@SybelBlue

@SybelBlue SybelBlue commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #39.

Summary

  • render mixed text and mathematics in toolbar labels with the host-provided MathJax instance
  • keep MathJax-owned label contents opaque to the internal DOM renderer across toolbar rerenders
  • typeset labels in the main toolbar, grouped dropdowns, and responsive overflow menu

PrairieLearn compatibility

This does not add MathJax as a package dependency or include it in the published bundle. It uses PrairieLearn's existing global MathJax.typesetPromise() implementation and limits typesetClear() calls to label elements owned by SketchResponse. The CDN script added to index.html is only for the standalone development demo.

@SybelBlue
SybelBlue marked this pull request as ready for review November 2, 2026 21:52
@SybelBlue
SybelBlue requested a review from nritschel November 2, 2026 21:52
@SybelBlue SybelBlue added the enhancement New feature or request label Nov 2, 2026
@nritschel

Copy link
Copy Markdown
Collaborator

I'm pretty sure that the MATH221E course already used Function $f(x)$ and the like to render tool names as Latex. (e.g., https://us.prairielearn.com/pl/course_instance/187162/instructor/question/9440947/preview/) What exactly is this adding on top of that?

@SybelBlue

Copy link
Copy Markdown
Collaborator Author

I dramatically simplified the rendering queue following our slack discussion. Let me know what you think.

@nritschel nritschel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tested the changes manually and everything works as intended.

@nritschel
nritschel merged commit e0798e1 into master Nov 3, 2026
5 checks passed
@nritschel
nritschel deleted the render-mathjax-tool-labels branch November 3, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render sketch-tool labels with MathJax

2 participants