On 01/04/2013 08:00 AM, Krinkle wrote:
Doxygen is indeed not meant for JavaScript. With some hacks it can be tricked into reading comment blocks from javascript files, but that won't scale for our code base, nor will it be enough to make a useful structure given the dynamic way JavaScript works.
JSDoc is pretty solid, though there are some concerns:
- The syntax is somewhat foreign compared to what we're doing right now
- Development is unclear (v2 on google-code has been discontinued, v3 on github is a rewrite still being worked on)
- Written in javascript, but doesn't run on node. Requires Java.
One that does run on node is YUIDoc. I'm using an older version successfully for ProveIt, and hopefully it has improved since then. http://yui.github.com/yuidoc/
I've recently looked into a documentation generator for VisualEditor and though I haven't stopped looking yet, I'm currently pausing rather long at JSDuck. It is very well engineered and especially optimised for modern JavaScript (inheritance, mixins, event emitters, override/overload methods from another module, modules, etc.).
How do you do modules? I don't see @module at https://github.com/senchalabs/jsduck/wiki/Guide . JSDoc (http://usejsdoc.org/#JSDoc3_Tag_Dictionary) and YUIDoc (http://yui.github.com/yuidoc/syntax/index.html) both have them.
I think the module concept is important, since we have so many, and many (e.g. the API ones) just modify existing classes.
It is also easy to extend when needing to implement custom @tags.
That's good, and we could use it to implement module.
I've set up a vanilla install for VisualEditor's code base here:
The docs definitely look great. I like (among other things) that they link to docs for the native types.
Right now, like MediaWiki core, VisualEditor is just documenting code loosely, not following any particular doc-syntax, so we're bound to require a few tweaks[1] no matter which framework we choose. Our current syntax is just something we came up with loosely based on what we're used to with Doxygen.
Right, we're going to have to change stuff either way, so the important thing is choosing something solid.
Right the demo on labs only uses the "Doc" app of JSDuck, but it also supports Guides, Demo's, interactive live-editable Examples and more.
A few random things I like in particular about JSDuck are:
- Support documenting parameters of callback functions
- Support documenting events emitted by a class/module
- Option to show/hide inherited methods and other characteristics
- Support to completely document objects for @param and @return (like @param {Object} foo, @param {number} foo.bar)
Those do sound pretty cool.
If it works out, I think we can get this going for MediaWiki core as well.
Great. I was thinking we could start with a Labs install just to see how it looks initially.
Regardless of the framework we choose, we should set it up to be generated for branches and update on merge from jenkins's post-merge hooks. Come to think of it, we should probably do that for the PHP/Doxygen as well (is that still running from the cronjob on svn.wikimedia.org?).
Agreed, auto-updating docs on merge would be nice.
Matt Flaschen