Skip to content

Commit 00c503a

Browse files
authored
preserve newlines before jsdoc comments where appropriate (#1341)
1 parent c5f8ac2 commit 00c503a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/site-kit/src/lib/markdown/renderer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,10 @@ async function convert_to_ts(js_code: string, indent = '', offset = '') {
563563
while (start > 0 && code.original[start - 1] === '\t') start -= 1;
564564
while (start > 0 && code.original[start - 1] === '\n') start -= 1;
565565

566-
code.overwrite(start, end, '');
566+
const slice = code.original.slice(node.getStart(), node.getEnd());
567+
const is_multiline = slice.includes('\n');
568+
569+
code.overwrite(start, end, is_multiline ? '\n' : '');
567570
}
568571
}
569572

0 commit comments

Comments
 (0)