dox
dox copied to clipboard
How to dox unrecognized context formats
For example, I have something like
import _ from 'underscore';
import template from 'header.hbs';
import ViewBase from 'ViewBase';
/**
* @class Header
* @extends {ViewBase}
*/
export default
class Header extends ViewBase {
/*
* Method documentation.
*/
someMethod() {
// ...
}
}
// Other stuff to document for the Header class, using underscore to extend the prototype.
_(Header.prototype).extend({
/*
* @property {Function} template A handlebars template function.
*/
template: template
});
As you can see there, I'm using the changes in PR #143 to document my class, but then I also need to document the properties I'm adding to the prototype in the following block (since ES6 classes don't allow properties to be added directly onto the prototype).
The way dox works, it'll still pick up this comment, but it might not know it's constructor/class, and the underscore _() syntax for extending the prototype isn't extended.
So, generally speaking, any ideas/suggestions on how we might be able to handle custom styles of code and associate them to constructors/classes, in a generic way? Maybe custom tags like @parentclass or @parentconstructor specifying the name of the parent constructor/class context? f.e.
/*
* @parentclass Header
*/
_(Header.prototype).extend({
/*
* @property {Function} template A handlebars template function.
*/
template: template
});
That's just an idea. Seems like a lot more thought is needed.
I think this is the concern that PR #85 was attempting to address with support for @lends. That PR wasn't mergable any more, but I'll look into adding support myself.
In general I think dox needs to support more implicit context values from tags.
I'll leave this issue open for now until I've had a chance to consider options.