Skip to content

Commit 7a34422

Browse files
committed
fixed extra line break in between two closing tags
1 parent 35e6b14 commit 7a34422

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/render/src/shared/utils/pretty.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ const prettyNodes = (
239239
lineBreak,
240240
);
241241
}
242+
formatted += lineBreak;
242243
} else if (node.type === 'tag') {
243244
const propertiesRawString = node.properties
244245
.map((property) => ` ${property.name}=${property.value}`)
@@ -248,13 +249,16 @@ const prettyNodes = (
248249
if (rawTagStart.length > maxLineLength) {
249250
let tagStart = `${indentation}<${node.name}`;
250251
for (const property of node.properties) {
251-
tagStart += `${indentation} ${property.name}=${property.value}${lineBreak}`;
252+
tagStart += `${indentation} ${property.name}=${property.value}${lineBreak}`;
252253
}
253254
tagStart += `${indentation}${node.void ? '/' : ''}>`;
254255
formatted += tagStart;
255256
} else {
256257
formatted += `${rawTagStart}`;
257258
}
259+
if (node.void) {
260+
formatted += lineBreak;
261+
}
258262

259263
if (!node.void) {
260264
if (node.children.length > 0) {
@@ -263,13 +267,13 @@ const prettyNodes = (
263267
options,
264268
currentIndentationSize + 2,
265269
)}`;
266-
formatted += `${lineBreak}${indentation}`;
270+
formatted += `${indentation}`;
267271
}
268272

269273
formatted += `</${node.name}>${lineBreak}`;
270274
}
271275
} else if (node.type === 'declaration') {
272-
formatted = `${indentation}${node.content}${lineBreak}`;
276+
formatted += `${indentation}${node.content}${lineBreak}`;
273277
}
274278
}
275279
return formatted;

0 commit comments

Comments
 (0)