Default MathJax version 2.7.1 does not render well on Edge
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 22.2k
- Forks
- 1.9k
- PR merge metrics
- PR metrics pending
Description
Problem
Hello, thanks for providing mdbook with MathJax support! I noticed an issue with rendering formulas in MathJax versions prior to 2.7.5. Alphabetic characters in formulas are not rendered as italic as expected.
Specifically, the character U+03B3 (Greek small letter gamma) is not rendered in italic fonts in MathJax 2.7.1 and 2.7.4, but it works fine in MathJax 2.7.5.
Environment:
- MacOS M2 Tahoe 26.1 (I just found this issue does not exist on my phone)
- mdbook 0.5.1
- Microsoft Edge 142.0.3595.94 arm64 (the latest official version)
Rendered HTML by MathJax for the formula \\( \gamma \\) ($\gamma$) is as follows:
-
MathJax 2.7.1(Current default):<span class="mi" id="MathJax-Span-22" style="font-family: STIXGeneral-Italic; padding-left: 0.305em;" >γ<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.053em;" ></span ></span>γ
-
MathJax 2.7.4(still not rendering correctly):<span class="mi" id="MathJax-Span-22" style="font-family: STIXGeneral-Italic; padding-left: 0.305em;" >γ<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.053em;" ></span ></span>γ
-
MathJax 2.7.5(fixes the issue):<span class="mi" id="MathJax-Span-22" style="font-family: STIXGeneral-Italic; padding-left: 0.305em;" >𝛾<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.053em;" ></span ></span>𝛾
Screenshots of the formula below in different MathJax versions are attached for reference:
\\[
\\alpha_i + \\beta_i = \\gamma
\\]
\\[
G_{\\mu\\nu} + \\lambda g_{\\mu\\nu} = \\frac{8 \\pi G}{c^4} T_{\\mu\\nu}
\\]
-
MathJax 2.7.1: -
MathJax 2.7.4: -
MathJax 2.7.5:
Proposed Solution
Though it's enough to update the default MathJax version (and users can also modify MathJax version by using the theme hack), I guess it's great to add configurable MathJax support and pick up some previous PRs (for example, https://github.com/rust-lang/mdBook/pull/1918, https://github.com/rust-lang/mdBook/pull/2285 and https://github.com/rust-lang/mdBook/pull/2069). For example, we can have a new configuration item as below:
[output.html.mathjax]
# Specify the MathJax version. However I'm not sure if we should check whether the version exists
version = "*.*.*"
# Or even specify the MathJax URL.
src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
And if a new PR is appreciated, I'm glad to work on it.
Notes
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining mdBook's HTML output configuration and the current MathJax integration, then review the referenced pull requests 1918, 2285, and 2069. Decide whether the fix is only updating the default MathJax version or adding configurable version and URL settings; done means generated formulas render correctly and the selected MathJax configuration works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rust
- Domain
- documentation, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100