-
Notifications
You must be signed in to change notification settings - Fork 15
feat(mathjax): upgrade mathjax from v2 to v4 #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
navinkarkera
wants to merge
8
commits into
openedx:main
Choose a base branch
from
navinkarkera:navin/mathjax-v4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d479b4c
fix(mathjax): support v3 APIs in extracted xblocks
navinkarkera c5fb2e4
test(mathjax): update problem specs for v3 APIs
navinkarkera 378f6c5
fix(discussion): support MathJax v4
navinkarkera 48e8f20
fix(mathjax): stabilize v4 xblock rendering
navinkarkera 2ca5e3d
fix(mathjax): stabilize v4 xblock rendering
navinkarkera ea22077
fix(mathjax): restore tex-delimited input detection in problem display
navinkarkera 989ae32
fix(mathjax): stop refreshMath binding on formula equation inputs
navinkarkera d02d862
Merge branch 'main' into navin/mathjax-v4
navinkarkera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
79 changes: 29 additions & 50 deletions
79
xblocks_contrib/discussion/assets/static/js/common/mathjax_include.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,35 @@ | ||
| // See common/templates/mathjax_include.html for info on Fast Preview mode. | ||
| var disableFastPreview = true, | ||
| vendorScript; | ||
| if (typeof MathJax === 'undefined') { | ||
| if (disableFastPreview) { | ||
| window.MathJax = { | ||
| menuSettings: {CHTMLpreview: false} | ||
| }; | ||
| } | ||
|
|
||
| vendorScript = document.createElement('script'); | ||
| vendorScript.onload = function() { | ||
| 'use strict'; | ||
|
|
||
| var MathJax = window.MathJax, | ||
| setMathJaxDisplayDivSettings; | ||
| MathJax.Hub.Config({ | ||
| tex2jax: { | ||
| inlineMath: [ | ||
| ['\\(', '\\)'], | ||
| ['[mathjaxinline]', '[/mathjaxinline]'] | ||
| ], | ||
| displayMath: [ | ||
| ['\\[', '\\]'], | ||
| ['[mathjax]', '[/mathjax]'] | ||
| ] | ||
| } | ||
| }); | ||
| if (disableFastPreview) { | ||
| MathJax.Hub.processSectionDelay = 0; | ||
| } | ||
| MathJax.Hub.signal.Interest(function(message) { | ||
| if (message[0] === 'End Math') { | ||
| setMathJaxDisplayDivSettings(); | ||
| } | ||
| }); | ||
| setMathJaxDisplayDivSettings = function() { | ||
| $('.MathJax_Display').each(function() { | ||
| this.setAttribute('tabindex', '0'); | ||
| this.setAttribute('aria-live', 'off'); | ||
| this.removeAttribute('role'); | ||
| this.removeAttribute('aria-readonly'); | ||
| }); | ||
| }; | ||
| }; | ||
| // Automatic loading of Mathjax accessibility files | ||
| window.MathJax = { | ||
| menuSettings: { | ||
| collapsible: true, | ||
| autocollapse: false, | ||
| explorer: true | ||
| tex: { | ||
| inlineMath: [ | ||
| ['\\(', '\\)'], | ||
| ['[mathjaxinline]', '[/mathjaxinline]'] | ||
| ], | ||
| displayMath: [ | ||
| ['\\[', '\\]'], | ||
| ['[mathjax]', '[/mathjax]'] | ||
| ], | ||
| autoload: { | ||
| color: [], | ||
| colorv2: ['color'] | ||
| }, | ||
| packages: {'[+]': ['noerrors']} | ||
| }, | ||
| options: { | ||
| ignoreHtmlClass: 'tex2jax_ignore', | ||
| processHtmlClass: 'tex2jax_process', | ||
| menuOptions: { | ||
| settings: { | ||
| collapsible: true, | ||
| explorer: true | ||
| }, | ||
| }, | ||
| }, | ||
| loader: { | ||
| load: ['input/asciimath', '[tex]/noerrors'] | ||
| } | ||
| }; | ||
| vendorScript.src = 'https://cdn.jsdelivr.net/npm/mathjax@2.7.5/MathJax.js?config=TeX-MML-AM_HTMLorMML'; | ||
| var vendorScript = document.createElement('script'); | ||
| vendorScript.src = 'https://cdn.jsdelivr.net/npm/mathjax@4.1.2/tex-mml-chtml.js'; | ||
| document.body.appendChild(vendorScript); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the matching case for plain input. Nothing asserts that
E=mc^2becomes`E=mc^2`, and that is the branch all existing content goes through. The TeX branch is new behavior and has a test, the one carrying the back-compat does not.