-
-
Notifications
You must be signed in to change notification settings - Fork 591
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
customHTMLElementModels not working with 'math' tags #635
Comments
@BenzterBit It is actually working but since you're extending the default model, the opaque flag is set: Instead, extend the |
@jsamr From what i am able to understand of what you are saying is that since the opaque flag is set, i won't be able to render the children and say using the other approach of custom rendering using renderers, I have to recursively render all the tags inside of mathml using MathJax individually? |
@BenzterBit Yes, clearly there are two approaches:
I'm sorry as I don't have much time to provide a snack. |
@jsamr I tried the second approach. I did what you said, and now atleast i can see the mathjax or some of it, that i am wiritng. But still it can't render the tags like say . For eg. for equation n/100 *x it will print n100 *x. It could've been due to me not specifying isOpaque: false, so i did it for each tag supported by mathml and rendered it through MathJax but even that didn't help, it gave the same 'n100 * x' Can you tell me how to proceed from here? So that i can render the entire equation |
@BenzterBit If you could provide snacks with the two approaches I'd be happy to help. |
@jsamr sure, please check the following 2 snacks
|
@jsamr also the rendered elements above are in a new line, can you tell me how to make them inline with the rest of the content |
@BenzterBit Inlining may or may not work because it basically relies on embedding To force inlining, you can use |
@jsamr couldn't do it through Mathjax, i converted the mathml incoming which is used a custom renderer using rnrh and converted it to latex using a library mathml-to-latex npm library. I used HTMLContentModel.textual and it did inline though, the styling is a bit off, which i am still figuring, if you do have any ideas on that. I will let you know after a few more tries |
@BenzterBit hi! could you share your changes with the rest of us? I think what you are trying to solve is in my usecase, it would be helpul to see a bit of code. We may have a common ground in what we are trying to do :) |
Thank @BenzterBit for the snack example, I also found a solution seems good for you @ihojmanb, I hope it is useful: |
Decision Table
<yyy>
is not rendered”Good Faith Declaration
Description
I wish to render my html content which contains 'math' tags along with a bunch of other tags.
My html content for example looks like
<p> <p>This is outta the park</p> <math xmlns="http://www.w3.org/1998/Math/MathML"><msqrt><mn>2</mn><mfrac bevelled="true"><mn>4</mn><mn>7</mn></mfrac></msqrt><mo>+</mo><mfrac><mn>5</mn><mn>8</mn></mfrac></math> <- this is just a math string <span>Please look above the problem is with the above math tags!</span> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam. </p> </p>
and i have defined my customHTMLElementModels as follows
const customHTMLElementModels = { math: defaultHTMLElementModels.math.extend({ contentModel: HTMLContentModel.block }) };
and my component's render function looks like the following:
<HTML width = { width} source={{html :customSource}} tagsStyles={SoltagsStyles} customHTMLElementModels={customHTMLElementModels} />
for which the output comes as such
As you can see, the math equation doesn't render.
I also tried using Custom Rendering using components.
using MathJax from react-native-mathjax
but same output
React Native Information
RNRH Version
6.3.4
Tested Platforms
Reproduction Platforms
Minimal, Reproducible Example
https://snack.expo.dev/@arnab_bit/mathtagparsing
Additional Notes
No response
The text was updated successfully, but these errors were encountered: