Skip to content

Commit

Permalink
feat(html/formatter): self close tag add slash char (#3984)
Browse files Browse the repository at this point in the history
  • Loading branch information
suxin2017 authored Sep 20, 2024
1 parent 26a7aae commit 44b0d16
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ impl FormatNodeRule<HtmlSelfClosingElement> for FormatHtmlSelfClosingElement {
space(),
attributes.format(),
space(),
slash_token.format(),
r_angle_token.format()
]
)
)?;

if slash_token.is_some() {
write!(f, [slash_token.format()])?;
} else {
write!(f, [text("/")])?;
}

write!(f, [r_angle_token.format()])
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<br />
<div>
<br>
<img>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ info: self-closing.html
# Input

```html
<br />
<div>
<br>
<img>
</div>
```
Expand All @@ -25,4 +27,7 @@ Attribute Position: Auto
-----
```html
<br />```
<div>
<br />
<img />
</div>```

0 comments on commit 44b0d16

Please sign in to comment.