Skip to content

Fix MathML rendering#149

Open
akhuoa wants to merge 30 commits intoPhysiome:mainfrom
akhuoa:bugfix/mathml
Open

Fix MathML rendering#149
akhuoa wants to merge 30 commits intoPhysiome:mainfrom
akhuoa:bugfix/mathml

Conversation

@akhuoa
Copy link
Copy Markdown
Contributor

@akhuoa akhuoa commented Apr 11, 2026

Fixes #78 and #126.

Problem

  • MathJax: MathJax becomes performance‑intensive when rendering large volumes of equations.
  • KaTeX: The mathematics content we have is in MathML, but KaTeX accepts only TeX as input.
  • Default: Browsers support MathML, but rendering is incomplete because some MathML elements (e.g., mfence) are deprecated.

Solution

Fix MathML rendering using w3c/mathml-polyfills instead of using MathJax or KaTeX.

  • Additionally, the mathematical equations are styled in middle alignment for better readability.

Testing

Before the update

After the update

Note: There are empty content filters applied from #148.

@akhuoa akhuoa marked this pull request as ready for review April 12, 2026 00:59
@akhuoa akhuoa requested a review from Copilot April 12, 2026 00:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses broken/incomplete MathML rendering in the Mathematics view by switching from MathJax/KaTeX approaches to using the W3C MathML polyfills, and applying formatting/styling to improve equation readability.

Changes:

  • Added a MathML transformer utility to load/apply W3C MathML polyfills and reformat MathML into an aligned table layout.
  • Updated the Exposure detail Mathematics view to initialize polyfills, transform/format MathML from math.json, and display an empty-state message.
  • Refined Mathematics view styling for centered, aligned equation rendering.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
src/utils/mathTransformer.ts Loads polyfills, transforms legacy MathML, and formats MathML into an mtable-based layout.
src/components/organisms/ExposureDetail.vue Integrates MathML transformation into the math view and updates math rendering styles/empty state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/mathTransformer.ts Outdated
Comment thread src/utils/mathTransformer.ts Outdated
Comment thread src/utils/mathTransformer.ts Outdated
Comment thread src/utils/mathTransformer.ts
Comment thread src/utils/mathTransformer.ts
Comment thread src/utils/mathTransformer.ts
Comment thread src/components/organisms/ExposureDetail.vue Outdated
@akhuoa akhuoa requested a review from agarny April 20, 2026 04:25
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.

Broken or inconsistent LaTeX in Mathematics view MathJax vs KaTeX

2 participants