Skip to content

Commit 8204596

Browse files
fix: ensure comments maintain new lines from docs
1 parent d5f3b6d commit 8204596

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ export const extendArray = <T>(arr1: T[], arr2: T[]): T[] => {
2929

3030
export const wrapComment = (comment: string, additionalTags: DocumentationTag[] = []): string[] => {
3131
if (!comment) return [];
32-
comment = comment.replace(/^\(optional\)(?: - )?/gi, '').trim();
32+
comment = comment.replace(/^\(optional\)(?: - )?/gi, '');
3333
if (!comment) return [];
3434
const result = ['/**'];
35-
while (comment.trim().length > 0) {
35+
while (comment.length > 0) {
3636
let index = 0;
3737
for (let i = 0; i <= 80; i++) {
3838
if (comment[i] === ' ') index = i;
@@ -41,7 +41,7 @@ export const wrapComment = (comment: string, additionalTags: DocumentationTag[]
4141
break;
4242
}
4343
}
44-
if (comment.length <= 80) {
44+
if (comment.length <= 80 && !comment.includes('\n')) {
4545
index = 80;
4646
}
4747
result.push(` * ${comment.substring(0, index)}`);

0 commit comments

Comments
 (0)