Custom HTML tag is not rendering properly, nor behaving the same way in different platforms #637
Open
11 of 15 tasks
Labels
bug
Crush'em all.
Decision Table
<yyy>
is not rendered”Good Faith Declaration
Description
hi folks! I'm using your library to render mathematical equations with the help of
react-native-mathjax-html-to-svg
. I'm creating a custom HTML tag,<math></math>
to wrap LaTeX equations and turn them into SVG images within the sorrounding HTML.I followed the steps of an article written by the Hashnode Engineering Team where they explain how they are using this libraries in order to render math equations in their mobile app.
Problem
Overall, the solution presented in this repository works fine: Math equations are successfully rendered in the app. However, there is a significant difference in the rendering between in-line math equations and block or display mathematics.
Display mathematics usually looks good, as they have plenty of space. The only time there is an issue is when we write long lines of math equations without breaklines, causing the SVG to extend beyond the margins of our screen. But this is not a problem since we can always write the LaTeX equations in a better format.
The main issue (and headache) arises when we try to render in-line mathematics, as it doesn't always look good. By that, I mean that the SVG generated by the rendering engine often overlaps with the non-mathematical text that precedes it or is not aligned with the same baseline as the text. As a result, it looks odd or even becomes unintelligible. This occurs in both iOS and Android simulators, with the issue being more pronounced in the Android simulator.
To illustrate this, please refer to the following image:
On the left, the Android Simulator. On the Right the iOS. As you can see, on Android there's heavy overlapping of in-line equations with the other content, while on iOS the equations are not on the same baseline, and in other cases there exists overlapping. On the other hand, block equations work fine.
Expected Behavior
The expected result is to be able to visualize in-line math equations in the same manner as they would appear in a Hashnode article, Notion page, or LaTeX document. This includes having the equations aligned with the content, placed on the same baseline, and rendered at a similar size to the surrounding font.
Here are some images for reference:
Hashnode editor
Notice though hashnode editor isn't perfect, it has some of the issues I've already described.
Notion editor
Here the Notion editor does a better job.
I know this issue might be related to styling, regarding position or alignment, but I'm out of know-how on how to debug the layers below the library. So any guidance on how to debug it, where to look at, or any idea would be much appreciated.
I would also like to mention that I'm not looking for a sophisticated solution or user experience like the ones Notion and Hashnode brings to their users, I'm just trying to simply render in-line mathematics with a solution that works :-), for our work with school teachers leveraged by the Center for Mathematical Modelling's Education Lab https://cmmedu.uchile.cl/, a public endeavor led by Universidad de Chile.
Happy coding!
React Native Information
RNRH Version
Tested Platforms
Reproduction Platforms
Minimal, Reproducible Example
Snack Link: https://snack.expo.dev/@ihojm/github.com-ihojmanb-math-equations-app
Github Repository: https://github.com/ihojmanb/math-equations-app
Additional Notes
No response
The text was updated successfully, but these errors were encountered: