views:

26

answers:

1

I want to document my jQuery plugin and I am a friend of putting the documentation - as usual in *doc approaches like Javadoc - together with the source code (so that I don't have to maintain it separately or even worse, twice).

Unfortunately JSDoc already fails on the standard way of wrapping your jQuery plugin source into an anonymous function like this:

(function($) { /* Plugin source here, JSDOC won't find anything */ })(jQuery);

What I am looking for is a simple source code parser that reads standard comments like /** ... */ and extracts the information from certain tags (like @param etc.) so that I can use them in my own documentation templates (I could adjust the comments so that they can be be regexed, too, but unfortunately I consequently fail at creating more complex regular expressions ;). Alternatively I welcome any other suggestion to document jQuery Plugins, it seems as if there isn't any established way for doing this though.

+1  A: 

I believe Doxygen can do this for you, as long as you follow its format (or one of the other supported formats it can do).

Reinderien