通过 innerHtml 在 dom 中插入 mathml 时,数学标记被删除

问题描述

我想渲染 MathML,但是当我将数据推入 dom 时,所有数学标签及其子标签都会被删除

我并在 quill 视图、div 和 innerHtml 中插入此数据,但在所有情况下问题都是相同的

<p>In elementary algebra,the <b>quadratic formula</b> is the solution of the quadratic equation.</p>
<p style="text-align: center;">
    <math xmlns="http://www.w3.org/1998/Math/MathML">
        <mi>x</mi>
        <mo>=</mo>
        <mfrac>
            <mrow>
                <mo>-</mo>
                <mi>b</mi>
                <mo>&#177;</mo>
                <msqrt>
                    <msup>
                        <mi>b</mi>
                        <mn>2</mn>
                    </msup>
                    <mo>-</mo>
                    <mn>4</mn>
                    <mi>a</mi>
                    <mi>c</mi>
                </msqrt>
            </mrow>
            <mrow>
                <mn>2</mn>
                <mi>a</mi>
            </mrow>
        </mfrac>
    </math>
</p>
<p><b>Water is made from two elements</b> - Hydrogen and Oxygen. If you put the two gases together,along with energy,you can make water.</p>
<p style="text-align: center;">
    <math class="wrs_chemistry" xmlns="http://www.w3.org/1998/Math/MathML">
        <mn>2</mn>
        <msub>
            <mi mathvariant="normal">H</mi>
            <mn>2</mn>
        </msub>
        <mfenced>
            <mi mathvariant="normal">g</mi>
        </mfenced>
        <mo>+</mo>
        <msub>
            <mi mathvariant="normal">O</mi>
            <mn>2</mn>
        </msub>
        <mfenced>
            <mi mathvariant="normal">g</mi>
        </mfenced>
        <mo>&#8652;</mo>
        <mn>2</mn>
        <msub>
            <mi mathvariant="normal">H</mi>
            <mn>2</mn>
        </msub>
        <mi mathvariant="normal">O</mi>
        <mfenced>
            <mi mathvariant="normal">l</mi>
        </mfenced>
    </math>
</p>
<p>The entire formula for the surface area of a cylinder is
    <math xmlns="http://www.w3.org/1998/Math/MathML">
        <mn>2</mn>
        <msup>
            <mi>&#960;r</mi>
            <mn>2</mn>
        </msup>
        <mo>+</mo>
        <mn>2</mn>
        <mi>&#960;rh</mi>
    </math>
</p>

但在 Dome 中,我无法看到所有数学标签 I am getting this My expectation is this

请帮助我自过去 3 天以来一直在努力

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)