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

prevent html closing tag to be placed on newline #58

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ThomasKalverda
Copy link
Member

https://trungk18.com/experience/prettier-prevent-html-closing-tag-new-line/

From this:

<span>
  I accept the
  <a class="underline" routerLink="/tnc"
    >Our terms and conditions</a
  >
</span>

To:

<span>
  I accept the
  <a class="underline" routerLink="/tnc">
    Our terms and conditions
  </a>
</span>

@jaap3
Copy link
Member

jaap3 commented Jan 29, 2024

There is actual white-space sensitivity in HTML. Your example could result in a change in rendering if we change this from the default (this is also explained in https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting).

The first snippet will result in Our terms and conditions while the second could result in  Our terms and conditions  (so the underline includes the whitespace inside the a tag) (depending on the styling etc.)

Without some proper testing to make sure this doesn't break anything, I wouldn't change this default.

@ThomasKalverda
Copy link
Member Author

@jaap3, ah shit, you're totally right. I guess I'll have to find another way to get rid of the ugly closing tags..

I'll play around with it some more and convert this PR to a draft for now

@ThomasKalverda ThomasKalverda marked this pull request as draft January 29, 2024 10:40
@jaap3 jaap3 removed their request for review February 19, 2024 08:49
@karlaevelize karlaevelize removed their request for review February 22, 2024 12:47
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

Successfully merging this pull request may close these issues.

2 participants