Fix MathML rendering#149
Conversation
There was a problem hiding this comment.
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.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
…r folder is ignored from tests
|
@agarny, I've made changes to the font sizes and alignments in the MathML rendering. |
agarny
left a comment
There was a problem hiding this comment.
This looks good, but:
- I would expect all variable names to be in italics. Right now, variable names of one character are in italics while variable names of 2+ characters are not. So, not consistent.
- I would decrease the font size of a sub/supscript (e.g., in an exponential). From what I can tell, it's 95% of the "default" font size but I feel like it's not small enough. I can also see that it's also 95% for
d/dtanda/b(among others?). Any particular reason? - Replace
^(in anifstatement) withand(and the same for "or", "xor", and "not").
@agarny, I've updated the formats and font sizes.
The updates can be tested on https://akhuoa.github.io/pmrapp-frontend/exposures/5f1/Tomek_model_endo.cellml/cellml_math?clearcache. |
Thanks, this looks much better... but I have just noticed:
If you want to mimic OpenCOR then:
|
@agarny, thanks for the feedback. I've updated them.
The updates are available on - |
Fixes #78 and #126.
Problem
Solution
Fix MathML rendering using w3c/mathml-polyfills instead of using MathJax or KaTeX.
Testing
Before the update
After the update
Note: There are empty content filters applied from #148.