beautifier / js-beautify

Beautifier for javascript
https://beautifier.io
MIT License
8.64k stars 1.39k forks source link

Wrapped <math> tag is not indented properly #2299

Open ztomaszyk opened 4 months ago

ztomaszyk commented 4 months ago

Description

Having math tag wrapped in some other html tag causes new lines and indentation issues. Both opening and closing math tags are in the same line as the wrapping tag. I am using html function with a default options in js script. Using Beautify HTML on https://beautifier.io/ page gives the same result.

Input

The code looked like this before beautification:

<div><math><mrow><munder><mo movablelimits="false">lim</mo><mrow><mi>n</mi><mo>→</mo><mi>N</mi></mrow></munder><mrow><mo>(</mo><mrow><mn>1</mn><mo>+</mo><mfrac><mn>1</mn><mi>n</mi></mfrac></mrow><mo>)</mo></mrow></mrow></math></div>

Expected Output

The code should have looked like this after beautification:

<div>
    <math>
        <mrow>
            <munder>
                <mo movablelimits="false">lim</mo>
                <mrow>
                    <mi>n</mi>
                    <mo>→</mo>
                    <mi>N</mi>
                </mrow>
            </munder>
            <mrow>
                <mo>(</mo>
                <mrow>
                    <mn>1</mn>
                    <mo>+</mo>
                    <mfrac>
                        <mn>1</mn>
                        <mi>n</mi>
                    </mfrac>
                </mrow>
                <mo>)</mo>
            </mrow>
        </mrow>
    </math>
</div>

Actual Output

The code actually looked like this after beautification:

<div><math>
        <mrow>
            <munder>
                <mo movablelimits="false">lim</mo>
                <mrow>
                    <mi>n</mi>
                    <mo>→</mo>
                    <mi>N</mi>
                </mrow>
            </munder>
            <mrow>
                <mo>(</mo>
                <mrow>
                    <mn>1</mn>
                    <mo>+</mo>
                    <mfrac>
                        <mn>1</mn>
                        <mi>n</mi>
                    </mfrac>
                </mrow>
                <mo>)</mo>
            </mrow>
        </mrow>
    </math></div>

Steps to Reproduce

  1. Go to https://beautifier.io/
  2. Paste following html in the editor:
    <div><math><mrow><munder><mo movablelimits="false">lim</mo><mrow><mi>n</mi><mo>→</mo><mi>N</mi></mrow></munder><mrow><mo>(</mo><mrow><mn>1</mn><mo>+</mo><mfrac><mn>1</mn><mi>n</mi></mfrac></mrow><mo>)</mo></mrow></mrow></math></div>
  3. Select Beautify HTML from dropdown and click Beautify Code

Environment

OS: https://beautifier.io/

Settings

default ones with no additional settings

AryaKS01 commented 1 month ago

I'm interested in doing it can u assign it to me?