Repository navigation
fix: add fallback to unsupported MathML tags in MathJax - #5127
Merged
Merged
Conversation
reinaldonetof
approved these changes
Jul 27, 2023
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed changes
We currently support Katex that use the MathJax pattern, but if they use some other pattern when writing a MathML tag, the lib we are using does not support it. (Usually tags that create html components, since html is not native, it's web code)
So this PR adds a fallback in case the informed MathML tag is not supported, it renders a webview with the correct tags.
It's not the best solution because rendering webview is costly for the system, but the only way to render html components is via webview.
To check if the script is a valid MathJax script or not, just go to the official website (https://www.mathjax.org/#demo) and insert it.
Example with the script used to "break" the app.
Issue(s)
How to test or reproduce
Send a message like "KaTeX".
Examples:
Plain MathML script:

\[ f(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi \]Expected output:
MathML script with html tags:

\[\colorbox{white}{\color{black} \boxed{ \begin{matrix} \;\;\;\;\overlinesegment{\underlinesegment{ \Huge Neues\;EntityModel \; in \; Bearbeitung} } & \\ \;\;develop\end{matrix}}}\]Expected output:
Screenshots
Types of changes
Checklist
Further comments
Jira: NATIVE-358