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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird caret formatting in html template literal #8310

Closed
skeggse opened this issue May 14, 2020 · 3 comments
Closed

Weird caret formatting in html template literal #8310

skeggse opened this issue May 14, 2020 · 3 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Comments

@skeggse
Copy link

skeggse commented May 14, 2020

Prettier 2.0.4
Playground link

--parser babel
--print-width 100

Input:

const message = html`
<p>
<span>Well wouldja lookit that - I mis-labeled the printer! <img alt="馃う" src="u1f926.png" /></span>
</p>
`;

Output:

const message = html`
  <p>
    <span
      >Well wouldja lookit that - I mis-labeled the printer! <img alt="馃う" src="u1f926.png"
    /></span>
  </p>
`;

Expected behavior:

const message = html`
  <p>
    <span>
      Well wouldja lookit that - I mis-labeled the printer!
      <img alt="馃う" src="u1f926.png" />
    </span>
  </p>
`;
@skeggse
Copy link
Author

skeggse commented May 14, 2020

Dupe of #8302, oops!

@skeggse skeggse closed this as completed May 14, 2020
@thorn0
Copy link
Member

thorn0 commented May 14, 2020

Not really a dupe. If you need whitespace before "Well..." and after img, add it manually. Prettier won't do it because it's unsafe.

@thorn0
Copy link
Member

thorn0 commented May 14, 2020

After adding whitespace and setting printWidth to 80, we get the expected result:

Prettier 2.0.5
Playground link

--parser babel

Input:

const message = html`
<p>
<span> Well wouldja lookit that - I mis-labeled the printer! <img alt="馃う" src="u1f926.png" /> </span>
</p>
`;

Output:

const message = html`
  <p>
    <span>
      Well wouldja lookit that - I mis-labeled the printer!
      <img alt="馃う" src="u1f926.png" />
    </span>
  </p>
`;

@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Aug 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

2 participants