-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Normalized form for standard TSDoc tags #13
Comments
TypeDoc currently has a related issue where the order of tags can interfere with how the tags are processed. This is caused because TypeDoc takes any text following the tag as the tag text so putting a tag like /**
* @internal
* Without the plugin, this comment does not show up in the
* docs because it's removed by typedoc tag processing
*/ See the single-line-tags plugin |
I think any text should belong to the preceding tag, even if it is delimitted by new lines. If no tag precedes the text, the text is considered being the description. If the description is desired somewhere else within the comment, the |
@iansan5653 raised this question again in #201:
Now that we've established an inventory of standard tags, maybe it's a good time to revisit this topic. Let's try to propose a "normalized" doc comment format that is aesthetically pleasing. This can serve as a spec for any rewriting that is (optionally) performed by the Something like this: /**
* The summary comes first.
*
* @remarks
* The `@remarks` tag always goes on its own line. It appears immediately after the summary.
*
* @example
* Other blocks appear after `@remarks` preserving their original input ordering,
* except that similar blocks are grouped together. For example, additional `@example`
* blocks are reordered to appear immediately after the first `@example` block.
*
* @throws {@link MySpecialError}
*
* If a block's syntax accepts special content on the same line, then a blank line
* should be skipped before the rest of the content.
*
* @param x - The parameters and return value are always the last block tags,
* so they will be visually closer to the function signature.
*
* @param y - If the parameters and return value descriptions are all single paragraphs
* less than 3 lines, then we can compress them by omitting newlines between the blocks.
*
* @returns
* The `@returns` section comes after the parameters. Then modifier tags come last.
* Modifiers tags are grouped onto a single line (with wrapping) and preserve their
* original input ordering.
*
* @beta @override @sealed
*/ What do you think? |
And here's an example of "compressed" param/returns: /**
* The summary comes first.
*
* @remarks
* The `@remarks` tag always goes on its own line. It appears immediately after the summary.
*
* @param x - the horizontal offset
* @param y - the vertical offset
* @returns `true` if anything changed, `false` otherwise
*
* @beta @override @sealed
*/ |
It seems odd to me that Broken tag: @rbuckton FYI |
Good points, thanks @Gerrit0 ! |
To me, I feel like intuitively most users will want to describe the parameters first (before I like putting all the modifier tags on the same line - that feels right. I don't think I agree with this:
To me, this makes it look like the information is detached from the tag - I think it should immediately follow: /**
* @throws {@link MySpecialError}
* The block content should always start on the line immediately following the
* block's opening tag.
*/ In general, how do we define which tags should have content start immediately following the tag ( |
Did someone make any progress on this in the last 4 years? 😸 For Maybe even |
Consider this example:
Is the ordering of tags important? Would this be legal:
What about this?
Some questions:
The text was updated successfully, but these errors were encountered: