-
Notifications
You must be signed in to change notification settings - Fork 486
Property/method distinction and @type support. #962
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
Comments
Sure, yeah - the Markdown documentation mode doesn't have a lot of the structure of the HTML output. The shape of the markdown documentation is decided by markdown_ast Whether one-liners are valid JSDoc - that's one of the quibbles with JSDoc that I'm trying to avoid for the long term by quietly forming dx-spec, a stricter and more modern specification. In the case of
In particular, it sounds like documentation.js is doing what the spec suggests is the correct behavior: the type tag does not have a description attached to its
This would be parsed correctly and would be valid. |
Makes sense, thanks. I can do without the About (1) and (2), for the example above, what do you think of this as proposed output? ### Table of Contents
- [Foo](#foo)
- Properties
- [foo](#foo-1)
- [bar](#bar)
- [zab](#zab)
- Methods
- [getFoo](#getfoo)
- [getBar](#getbar)
## Foo
Represents a foo, provides access to the bar and the zab.
### Properties
#### foo
It is the foo.
Type: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)
#### bar
It is the bar.
Type: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)
#### zab
It is the zab.
Type: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)
### Methods
#### getFoo
Gets the foo.
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)**
#### getBar
Gets the bar.
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Loosely based on three.js docs, and would probably need to handle static properties/methods similarly. Here's how that might work in markdown_ast.js. |
If you're reporting a bug, please include input code, output documentation,
a description of what you expected to happen, and what happened instead.
Input
Output
Current/desired output
Setting aside the readability of this code (it's a reduced example based on https://github.com/dataarts/dat.gui), a few things are not being documented as I had hoped:
@type
tag isn't reflected for any of the properties; no type information shows up.@type
used in oneliners as/** @type {number} Quantity of foo. */
. I'm not sure if that's actually valid JSDoc, but curious for your thoughts. Here, the description is ignored when written this way.Related to #906 and #246.
Thanks for writing this tool! Let me know if changes for any of this would be reasonable or wanted.
Other
The text was updated successfully, but these errors were encountered: