From dc89058faa7a69bb6764689453af85a7984dcecb Mon Sep 17 00:00:00 2001 From: Maximilian Koeller Date: Thu, 12 Sep 2024 11:24:19 +0200 Subject: [PATCH 1/2] The content after @defaultValue should remain on the same line --- .../default-value-inline-content_2024-09-12-09-25.json | 10 ++++++++++ tsdoc/src/emitters/TSDocEmitter.ts | 5 ++++- tsdoc/src/emitters/__tests__/TSDocEmitter.test.ts | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json diff --git a/common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json b/common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json new file mode 100644 index 00000000..eb04991e --- /dev/null +++ b/common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/tsdoc", + "comment": "Make the TSDocEmitter do not emit a newline for the text after @defaultValue.", + "type": "patch" + } + ], + "packageName": "@microsoft/tsdoc" +} \ No newline at end of file diff --git a/tsdoc/src/emitters/TSDocEmitter.ts b/tsdoc/src/emitters/TSDocEmitter.ts index 298146a9..1d2d5e6f 100644 --- a/tsdoc/src/emitters/TSDocEmitter.ts +++ b/tsdoc/src/emitters/TSDocEmitter.ts @@ -102,7 +102,10 @@ export class TSDocEmitter { this._ensureLineSkipped(); this._renderNode(docBlock.blockTag); - if (docBlock.blockTag.tagNameWithUpperCase === StandardTags.returns.tagNameWithUpperCase) { + if ( + docBlock.blockTag.tagNameWithUpperCase === StandardTags.returns.tagNameWithUpperCase || + docBlock.blockTag.tagNameWithUpperCase === StandardTags.defaultValue.tagNameWithUpperCase + ) { this._writeContent(' '); this._hangingParagraph = true; } diff --git a/tsdoc/src/emitters/__tests__/TSDocEmitter.test.ts b/tsdoc/src/emitters/__tests__/TSDocEmitter.test.ts index 5216452a..055e9315 100644 --- a/tsdoc/src/emitters/__tests__/TSDocEmitter.test.ts +++ b/tsdoc/src/emitters/__tests__/TSDocEmitter.test.ts @@ -84,6 +84,7 @@ test('02 Emit a basic comment', () => { * line1 * line2 * \`\`\` + * @defaultValue value * * @public @readonly */ @@ -114,6 +115,8 @@ Object { * line2 * \`\`\` * + * @defaultValue value + * * @public @readonly */ ", From d77ce2a6792af06d64130b86baa1f3f7be3c5b21 Mon Sep 17 00:00:00 2001 From: Daniel <3473356+D4N14L@users.noreply.github.com> Date: Wed, 2 Oct 2024 08:27:16 -0700 Subject: [PATCH 2/2] Update default-value-inline-content_2024-09-12-09-25.json --- .../tsdoc/default-value-inline-content_2024-09-12-09-25.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json b/common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json index eb04991e..d0c6e57b 100644 --- a/common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json +++ b/common/changes/@microsoft/tsdoc/default-value-inline-content_2024-09-12-09-25.json @@ -2,7 +2,7 @@ "changes": [ { "packageName": "@microsoft/tsdoc", - "comment": "Make the TSDocEmitter do not emit a newline for the text after @defaultValue.", + "comment": "Ensure TSDocEmitter does not emit a newline for the text after `@defaultValue` tags.", "type": "patch" } ],