Skip to content

chore(html/formatter): better control over spacing #5604

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

Merged
merged 1 commit into from
Apr 8, 2025
Merged

Conversation

ematipico
Copy link
Member

Summary

This is a follow-up of #5600 (comment)

We don't print a space after the tag name if it's a void element and there aren't attributes.

Test Plan

Updated the tests

@github-actions github-actions bot added A-Formatter Area: formatter L-HTML Language: HTML labels Apr 8, 2025
@@ -20,7 +20,7 @@ impl FormatNodeRule<HtmlSelfClosingElement> for FormatHtmlSelfClosingElement {
let name = name?;
let is_canonical_html_tag = is_canonical_html_tag(&name);

write!(f, [l_angle_token.format(), name.format(), space()])?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This space doesn't make a difference, so I removed it

@@ -6,20 +6,21 @@ snapshot_kind: text
# Input

```html
Lorem ipsum<span />dolor sit amet, consectetur adipiscing elit. Sed eu diam vel
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change this example with valid self-closing tags

@ematipico ematipico requested review from dyc3 and a team April 8, 2025 08:01
Copy link

codspeed-hq bot commented Apr 8, 2025

CodSpeed Performance Report

Merging #5604 will not alter performance

Comparing chore/better-spacing (92d4e37) with main (2d699e3)

Summary

✅ 95 untouched benchmarks

@dyc3 dyc3 merged commit e54b047 into main Apr 8, 2025
13 checks passed
@dyc3 dyc3 deleted the chore/better-spacing branch April 8, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter L-HTML Language: HTML
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants