-
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: @see
block tag specifies an item for a "See Also" section
#235
Comments
We discussed the You can already write this: /**
* Adds numbers using arithmetic.
* @remarks
* For more information, see {@link https://en.wikipedia.org/wiki/Arithmetic|Arithmetic}.
* @param x - the first number
* @param y - the second number
* @returns the sum. For more information, see also {@link subtractNumbers}.
*/
function addNumbers(x: number, y: number): number; I know that DocFX can render a "See Also" section. But it is a bulleted list of references. You could simulate it with a heading and markdown bullets (not yet parsed by TSDoc but coming soon): /**
* Adds numbers using arithmetic.
* @remarks
* Some more information here.
*
* # See Also
* - {@link https://en.wikipedia.org/wiki/Arithmetic|Arithmetic}.
* - {@link subtractNumbers}
*
* @param x - the first number
* @param y - the second number
* @returns the sum
*/
function addNumbers(x: number, y: number): number; ...which might get rendered like this:
Based on this, I could imagine some value in standardizing a /**
* Adds numbers using arithmetic.
* @remarks
* Some more information here.
*
* @seealso
* - {@link https://en.wikipedia.org/wiki/Arithmetic|Arithmetic}.
* - {@link subtractNumbers}
*
* @param x - the first number
* @param y - the second number
* @returns the sum
*/
function addNumbers(x: number, y: number): number; But JSDoc's @hbergren how are you using CC @rbuckton |
I'm also interested to know more about JSDoc's semantics. Their docs give this example: /**
* @see {@link foo} for further information.
* @see {@link http://github.com|GitHub}
*/
function bar() {} But it doesn't explain how it would get rendered by the documentation system. |
What happens if you have multiple |
Essentially, The reason I based #205 on synonyms is that DocFX calls this a |
Ahh ok. So If our documentation template uses bullets, then our spec is that this input (with intentionally scrambled ordering)... /**
* Adds numbers using arithmetic.
* @see {@link https://en.wikipedia.org/wiki/Arithmetic|Arithmetic}.
* @remarks
* Some more
* information here.
* @see
* {@link subtractNumbers}
* @see *Elements*
* by Euclid
* @param x - the first number
* @param y - the second number
* @returns the sum
*/
function addNumbers(x: number, y: number): number; ...might get rendered like this:
That seems like a pretty useful and reasonable design. |
JSDoc also specifies:
This aspect seems problematic. Namepaths are ambiguous with free-form text. For example, if instead of this:
...I wrote it as:
...then how is the parser supposed to know whether Elements was meant to be an API item reference or a free-form title? Thus I'd propose that TSDoc omit this aspect and instead require an explicit Are you guys okay with that? |
I would say its something like a block tag, yes. And you are correct they would all be grouped together. I imagine it should behave similar to something like this: /**
* @param foo
* @remarks some remarks...
* @param bar
*/
function f(foo, bar) { ... } I would expect the |
@see
tag@see
block tag specifies an item for a "See Also" section
In @hbergren's version of my For context, |
I'm not sure we can issue a warning, because Thinking about this, if someone is using TSDoc to parse legacy JSDoc comments, they probably do not care a whole lot about some missing hyperlinks. The people requesting "lax" rules seem mainly concerned with suppressing TSDoc errors, because errors require work to fix. If a legacy notation can be reliably detected (e.g. Does that make sense? |
This is exactly the behavior I would expect from TSDoc for precisely the reason you describe. TSDoc makes it possible to look at a comment and know exactly what will be rendered. This is a huge benefit to using it. |
Good point. I really want to go implement this for API Extractor. It's so little work. :-) |
Since this is an RFC, let's keep this issue open. All the RFC issues will get closed when the formal spec is completed. |
I use the
eslint-plugin-tsdoc
for linting, and noticed that the JSDoc @see tag is not supported in the list of TSDoc tags.We use
@see
tags extensively in one of our projects, so it would be great to add support for it so the TSDoc ESLint plugin doesn't warn for using that tag.I'm happy to write a PR. Is all it takes adding this to the list of TSDoc tags?
The text was updated successfully, but these errors were encountered: