JSDoc is a markup language used to annotate JavaScript source code files. Using comments containing JSDoc, programmers can add documentation describing the application programming interface of the code they're creating. This is then processed, by various tools, to produce documentation in accessible formats like HTML and Rich Text Format. The JSDoc specification is released under CC BY-SA 3.0, while its companion documentation generator and parser library is free software under the Apache License 2.0.

History

JSDoc's syntax and semantics are similar to those of the Javadoc scheme, which is used for documenting code written in Java. JSDoc differs from Javadoc, in that it is specialized to handle JavaScript's dynamic behaviour.

An early example using a Javadoc-like syntax to document JavaScript was released in 1999 with the Netscape/Mozilla project Rhino, a JavaScript run-time system written in Java. It included a toy "JSDoc" HTML generator, versioned up to 1.3, as an example of its JavaScript capabilities.

All main generations of "JSDoc" were headed by micmath (Michael Mathews). He started with JSDoc.pm in 2001, a simple system written in Perl. Later, with contributions by Canadian programmer Gabriel Reid. It was hosted on SourceForge in a CVS repository. By JSDoc 1.0 (2007) he rewrote the system in JavaScript (again for Rhino), and after a set of expansions JSDoc 2.0 (2008) gained the name "jsdoc-toolkit". Released under the MIT License, it was hosted in a Subversion repository on Google Code. By 2011 he has refactored the system into JSDoc 3.0 and hosted the result on GitHub. It now runs on Node.js.

JSDoc tags

Some of the more popular annotation tags used in modern JSDoc are:

Example

Note that the @class and @constructor tags can in fact be omitted: the ECMASyntax is sufficient to make their identities clear, and JSDoc makes use of that. @override can be automatically deduced as well.

JSDoc in use

  • Google's Closure Linter and Closure Compiler. The latter extracts the type information to optimize its output JavaScript.
  • TypeScript can perform type checking for JavaScript files with JSDoc type annotations. Microsoft has specified a new TSDoc language with extensible tags.
  • Popular editor Sublime Text supports JSDoc through the DocBlockr or DoxyDoxygen plugin
  • The JSDoc syntax has been described at length in the Apress book Foundations of Ajax ISBN 1-59059-582-3.
  • Various products of JetBrains, like IntelliJ IDEA and WebStorm, NetBeans, Visual Studio Code and RubyMine understand JSDoc syntax.
  • Eclipse-based Aptana Studio supports ScriptDoc.
  • Mozile, the Mozilla Inline Editor uses JSDoc.pm.
  • The Helma application framework uses JSDoc.
  • SproutCore documentation was generated using JSDoc.
  • Visual Studio, WebStorm and many other Integrated development environments or Text Editors offer Code Completion and other assistance based on JSDoc comments.
  • Open source Atom editor supports JSDoc via the atom-easy-jsdoc plugin.

See also

  • Comparison of documentation generators
  • Google Closure Tools

References

External links

  • Official website
  • jsdoc on GitHub
  • "Annotating JavaScript for the Closure Compiler". Google Developer. Closure Tools documentation.

JSDoc과 사용법

Jsdoc Templates williamsonga.us

How to Document JavaScript Code Using JSDoc

tidyjsdoc npm

Documentação do JavaScript com JSDoc Blog do Rah