Is there a way to generate Javascript API documentation like the Google Closure Library API Documentation?

青春壹個敷衍的年華 提交于 2019-11-29 20:57:32
haylem

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.

Check out YUI Doc.

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.

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

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!