30

I'm trying to find a tool that generates HTML documentation for my Javascript source code.

Does anyone know if the tool that Google uses to generate the interface at the following URLs is open source? Would I be able to generate similar output?

http://closure-library.googlecode.com/svn/docs/class_goog_proto2_Serializer.html

http://closure-library.googlecode.com/svn/docs/namespace_goog_date.html

http://closure-library.googlecode.com/svn/docs/namespace_goog_events.html

http://closure-library.googlecode.com/svn/docs/class_goog_gears_Database.html

http://closure-library.googlecode.com/svn/docs/class_goog_ui_DatePicker.html

I'm aware of http://code.google.com/p/jsdoc-toolkit/

But I'd like to know if the specific generator that Google uses is available for me to use for my own source (which is going to be open source, if that matters).

Thanks in advance...

Homer6
  • 15,034
  • 11
  • 61
  • 81
  • Found this quote "google closure compiler uses JSDoc documentation system which simultaneously (if created by the programmer correctly) provides documentation and enables catching many errors at compile time." from http://stackoverflow.com/questions/1690197/what-does-google-closure-library-offer-over-jquery/2339186#2339186 Would like to know more on that... – Homer6 Sep 29 '10 at 07:09

5 Answers5

28

Google Closure + JSDoc

As you mentioned yourself in your comment, they build on JSDoc Toolkit to add special annotations used by the Closure Compiler for type-checking and other things, but this means you can also just use JSDoc on top of closure code to generate your documentation. Generating an output with the desired look and feel is then only a matter of writing your own template and stylesheet.

The Google Closure Tools are all open source except for some bits that aren't disclosed at the moment. In any case, you can have a look at the documentation and source code and see what they use to generate Javadocs.

ExtJS + Ext-Doc

Another one you could possibly have a look at for inspiration and to see how they do it is the online doc for ExtJS. I find it a bit confusing to navigate at first, but you get used to it fairly quickly. An open source project, Ext-Doc, generates documentation with a similar style, though it is now a bit outdated.

YUI Doc

As mentioned by Matthew Manela, YUI Doc produces pretty good online documentation as well.

My advice would be to go for JSDoc as it is the de-facto standard for many tools and it reflects Java practices, but it's really up to what you want.

Community
  • 1
  • 1
haylem
  • 22,460
  • 3
  • 67
  • 96
  • 1
    The documentation annotation of JSDoc toolkit is different from Google Closure, why is that? Even more important, is it possible to generate documentation using some part of Google Closure? Their online API reference looks amazing. – Betamos Jun 28 '11 at 13:08
  • @Betamos: sorry, never noticed your follow-up question. The reason why Closure's documentation format is not entirely identical to JSDoc is that they add their own set of parameters, as far I know. – haylem Feb 27 '12 at 17:33
  • @Betamos: Also, it's most probably possible to generate the documentation the same way they do. However it will probably take a lot of hacking, as their tool generates the doc for their library. Maybe youc an try to make it generate another doc, but I cannot make any assumptions on the difficulty to do this. – haylem Feb 27 '12 at 17:35
2

A newer option is http://documentation.js.org/ which uses JSDoc and generates HTML:

Documentation.js example

You can run it with gulp https://github.com/documentationjs/gulp-documentation

Andrew
  • 1,041
  • 1
  • 16
  • 24
2

Check out YUI Doc.

Matthew Manela
  • 16,572
  • 3
  • 64
  • 66
2

For the ones using ExtJs, https://github.com/senchalabs/jsduck is awesome.

For the ones not using ExtJS but familiar with Ruby, https://github.com/b-studios/doc.js is great.

Utensil
  • 17,204
  • 1
  • 17
  • 10
1

Dossier is currently (2016) being used to build the Closure Library documentation. It is a fantastic tool that is built on top of Closure Compiler itself, so it actually reads all the type information using the compiler and then outputs documentation instead of code.

There are still some things being worked out about the user interface of the docs. Currently that Closure Library docs page looks rather empty -- you have to click on the "hamburger menu" symbol in upper left to get started.

owler
  • 1,059
  • 8
  • 13
  • Thank you so much! I think this is by far the best documentation generator for javascript! – arkod Feb 17 '17 at 10:53