Skip to content

📝 HTML formatter collapses inline element content onto single line in Svelte files #9099

@petrzelka

Description

@petrzelka

Environment information

When formatting Svelte files with experimentalFullSupportEnabled, the HTML formatter collapses inline element content (like or custom components) with embedded expressions onto a single line, instead of keeping them on separate lines.
This affects both css and strict whitespace sensitivity modes, producing different but equally incorrect results.
Input

 <ul>
            <li>
              <div>
              
                {name}

              
              </div>
            </li>
        </ul>

Expected output (matches Prettier with htmlWhitespaceSensitivity: "css")

<ul>
  <li>
    <div>
      {name}
    </div>
  </li>
</ul>

Actual output
With whitespaceSensitivity: "css" (default):

<ul>
	<li>
		<div>{name}</div>
	</li>
</ul>

With whitespaceSensitivity: "strict":

<ul>
	<li> <div> {name} </div> </li>
</ul>

Playground link

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-FormatterArea: formatterL-HTMLLanguage: HTML and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions