Skip to content
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

Support omitting self-closing tags of void elements like <meta> #95

Open
matthew-puku opened this issue Sep 10, 2024 · 2 comments
Open

Comments

@matthew-puku
Copy link

Hey there,

This project is awesome!

Proposal

I wondered if it'd be worthwhile to make void elements not self-closing.

For example, <br>s might output as:

<p>
  so much depends<br>
  upon<br>
  <br>
  a red wheel<br>
  barrow<br>
  <br>
  glazed with rain<br>
  water<br>
  <br>
  beside the white<br>
  chickens.
</p>

Currently, the output looks like this:

<p>
  so much depends<br />
  upon<br />
  <br />
  a red wheel<br />
  barrow<br />
  <br />
  glazed with rain<br />
  water<br />
  <br />
  beside the white<br />
  chickens.
</p>

But why?

@davidwessman
Copy link
Owner

@rdimartino what do you think about this suggestion? Since you made some changes to the void-tags.

According to erb_lint they consider self-closing void elements to be XHTML style and writing them without self-closing as HTML5 style which I think is what modern browsers are targeting.

@rdimartino
Copy link

@davidwessman I think that I used self-closing tags in #73 to match how prettier formats HTML in my project, but I have come to believe that they're doing it wrong. I think this plugin should still be able to parse self-closing tags, but I support formatting the void elements as suggested here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants