jleyba / js-dossier

A JavaScript documentation generation tool.
Apache License 2.0
150 stars 15 forks source link

how to add namespace description? #76

Open myphysicslab opened 8 years ago

myphysicslab commented 8 years ago

Namespaces occupy a prominent place in the docs now, and they have a nice list of Interfaces and Classes. But they always say "No description available" underneath the namespace name at top.

I've tried adding variants of the @namespace tag as shown at http://usejsdoc.org/tags-namespace.html but nothing has worked so far.

It's unclear where that tag would be added, however when I click on the "show source" button it takes me to the goog.provide statement of one of the classes of the namespace and I've tried adding the @namespace tag there. For the myphysicslab.lab.app namespace:

/** Helper classes for applications
@namespace
*/
goog.provide('myphysicslab.lab.app.EventHandler');

I've also tried

/** Helper classes for applications
@namespace myphysicslab.lab.app
*/
goog.provide('myphysicslab.lab.app.EventHandler');
jleyba commented 8 years ago

You can't add a namespace description. I should probably change that to not output anything when a description is missing.

If you use goog.module (or an ES6 module), it will use the block comment with a @fileoverview tag as the module description. We can't do that for namespaces since you could have multiple goog.provide statements in a file.

With respect to the @namespace tag - is that recognized by the compiler? I want the code you run through dossier to be valid input for the closure compiler without extra tag declarations.

myphysicslab commented 7 years ago

With respect to the @namespace tag - is that recognized by the compiler? I want the code you run through dossier to be valid input for the closure compiler without extra tag declarations.

You can use the compiler option --extra_annotation_name which specifies "a whitelist of tag names in JSDoc."

A set of extra annotation names which are accepted and silently ignored when encountered in a source file.

But would need to invent some way to gather the information for the namespaces.

BTW, the list of interfaces & classes in a namespace has disappeared, would be nice to get that back.

ribrdb commented 7 years ago

So do you just ignore @fileoverview tags in files using goog.provide? Many of the closure-library files have useful @fileoverview's, that seem to disappear in the docs. For example: https://github.com/google/closure-library/blob/master/closure/goog/dom/animationframe/animationframe.js#L99 Maybe you could attach them to the first provided namespace? Or even all of them?