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

HTML formatting differs in .svelte and .html files #58

Closed
bdadam opened this issue Sep 12, 2019 · 0 comments · Fixed by #120
Closed

HTML formatting differs in .svelte and .html files #58

bdadam opened this issue Sep 12, 2019 · 0 comments · Fixed by #120
Labels
enhancement New feature or request

Comments

@bdadam
Copy link

bdadam commented Sep 12, 2019

I have markup for a component like this:

<div>
    <a href="/some-long-href-lorem-ipsum/">Lorem ipsum lorem ipsum 1</a>,
    <a href="/some-long-href-lorem-ipsum/">Lorem ipsum lorem ipsum 2</a>,
    <a href="/some-long-href-lorem-ipsum/">Lorem ipsum lorem ipsum 3</a>
</div>

If I put this code into a component.html file and let prettier format it then the formatting stays as it is above.

However if I put this markup into a component.svelte file then it gets formatted to this:

<div>
    <a href="/some-long-href-lorem-ipsum/">Lorem ipsum lorem ipsum</a>
    ,
    <a href="/some-long-href-lorem-ipsum/">Lorem ipsum lorem ipsum</a>
    ,
    <a href="/some-long-href-lorem-ipsum/">Lorem ipsum lorem ipsum</a>
</div>

This is a problem if the a tags are styled as display: inline-block;. To avoid I have the folllowing setting in my .prettierrc file:

{ "htmlWhitespaceSensitivity": "strict" }

I suppose that prettier-plugin-svelte somehow doesn't regard this setting.

@Conduitry Conduitry added the enhancement New feature or request label May 8, 2020
dummdidumm pushed a commit that referenced this issue Aug 27, 2020
This solves the issue of whitespace either being wrongly added or removed inside inline tags or between text and tags.
Fixes #58, fixes #103, fixes #24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants