Skip to content

Commit 565b795

Browse files
committed
fix: improve tsdoc compatibility
1 parent 665b979 commit 565b795

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/utils/jsdoc.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,11 @@ function renderJsDocTagAsPlainText(tag: JsDocBlockTag): string {
9595

9696
if (tag.value) {
9797
if (tag.name === 'example') {
98-
if (tag.value.match(/^[\n\r \t]/)) {
99-
result += `:${tag.value}`;
98+
const value = tag.value.replace(/[\n]?$/g, '\n');
99+
if (value.match(/^[\n]/)) {
100+
result += `:\n\`\`\`${value}\`\`\``;
100101
} else {
101-
result += `:${tag.value.replace(/^([^\n]+)\n/, ' "$1":\n```')}\`\`\``;
102+
result += `:${value.replace(/^([^\n]+)\n/, ' "$1":\n```')}\`\`\``;
102103
}
103104
} else {
104105
result += ':';

0 commit comments

Comments
 (0)