Skip to content

🐛 BUG: Plugin changes order of HTML elements when one inner element has no closing tag #437

@trueberryless

Description

@trueberryless

Describe the Bug

When you unintentionally create not well-formed HTML the plugin will change the order of the closing tags, which will mess up the HTML even more.

Expected behaviour

First of all, I need to mention that it is my own fault that I wrote malformed HTML in the first place, so it makes total sense if this plugin doesn't account such scenarios...

However, it would be very cool if the plugin also handles such cases write and just adds the missing closing tags in the right place.

Example

The HTML before prettier:

<div>
   <main>
      <section>
         <h2 class="section-title">Origin of trueberryless</h2>
         <div class="content">
            <p>
               Ever wondered how I came up with my unique username? It’s a story of boredom, ambition, and three long days of brainstorming during my 2022 internship. Curious about the journey? <a href="/username/">Read the full tale here.</a>
            </p>
         // missing closing tag
      </section>
   </main>
   <ContactCTA />
</div>

The HTML after prettier:

<div>
   <main>
      <section>
         <h2 class="section-title">Origin of trueberryless</h2>
         <div class="content">
            <p>
               Ever wondered how I came up with my unique username? It’s a story of
               boredom, ambition, and three long days of brainstorming during my
               2022 internship. Curious about the journey? <a href="/username/"
                  >Read the full tale here.</a
                  >
            </p>
         </div>
      </section>
      <ContactCTA /> // this element must be after main closing tag
   </main>
</div>

Reference:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions