Sub6Resources / flutter_html

A Flutter widget for rendering static html as Flutter widgets (Will render over 80 different html tags!)
https://pub.dev/packages/flutter_html
MIT License
1.75k stars 805 forks source link

Inconsistency in Rendering of the <math> Tag with Complex MathML Content #1402

Open yihong1120 opened 4 months ago

yihong1120 commented 4 months ago

Dear flutter_html Maintainers,

I hope this message finds you well. I am reaching out to report an issue I've encountered whilst utilising the flutter_html package, specifically concerning the rendering of MathML content within the <math> tag.

Upon integrating complex MathML equations into my application, I observed that certain elements are not rendered as anticipated. This is particularly evident when dealing with intricate formulas that include nested fractions, matrices, and stretchy operators. The rendered output occasionally exhibits misalignment and incorrect scaling, which detracts from the readability and professional appearance of the mathematical expressions.

To illustrate, consider the following MathML snippet:

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mrow>
    <msup>
      <mi>a</mi>
      <mn>2</mn>
    </msup>
    <mo>+</mo>
    <msup>
      <mi>b</mi>
      <mn>2</mn>
    </msup>
    <mo>=</mo>
    <msup>
      <mi>c</mi>
      <mn>2</mn>
    </msup>
  </mrow>
</math>

While the above example is relatively straightforward, it serves to demonstrate the type of content that, when expanded upon, leads to the aforementioned rendering issues.

I understand that the flutter_html_math extension leverages the flutter_math_fork plugin to parse MathML into TeX, which may not fully support all MathML features. However, I believe that enhancing the robustness of MathML rendering could significantly benefit users who require precise and accurate display of mathematical content.

Might I suggest a review of the current MathML to TeX parsing logic, or potentially exploring alternative rendering engines that offer more comprehensive MathML support? Additionally, it would be beneficial to provide users with guidance on how to handle or work around unsupported MathML elements within the current framework.

I appreciate the effort that has gone into developing this package and its extensions, and I am looking forward to any improvements that could be made in this area.

Thank you for your time and consideration.

Best regards, yihong1120

wattfarnas97 commented 2 months ago

Hello @yihong1120 did you find a solution?