A programmatic interface for jsdoc3 with a few extra features.
- Provides sync, async (Promise) and streaming interfaces for the two main jsdoc operations ('explain' and 'render documentation').
- Supply source code via a string, a set of file names or a stream.
- Optional caching, dramatically boosting subsequent run performance on the same input.
- Supports
.html
input files documenting the contained javascript.
Example
> const jsdoc = require('jsdoc-api')
> jsdoc.explainSync({ source: '/** example doclet *∕ \n var example = true' })
[ { comment: '/** example doclet *∕',
meta:
{ range: [ 28, 42 ],
filename: 'nkrf18zlymohia4i29a0zkyt84obt9.js',
lineno: 2,
path: '/var/folders/74/tqh7thm11tq72d7sjty9qvdh0000gn/T',
code:
{ id: 'astnode100000002',
name: 'example',
type: 'Literal',
value: true } },
description: 'example doclet',
name: 'example',
longname: 'example',
kind: 'member',
scope: 'global' },
{ kind: 'package',
longname: 'package:undefined',
files: [ '/var/folders/74/tqh7thm11tq72d7sjty9qvdh0000gn/T/nkrf18zlymohia4i29a0zkyt84obt9.js' ] } ]
- jsdoc-api
- static
- .explainSync([options]) ⇒
Array.<object>
- .explain([options]) ⇒
Promise
- .createExplainStream([options]) ⇒
Duplex
- .renderSync([options])
- .clean() ⇒
Promise
- .explainSync([options]) ⇒
- inner
- ~JsdocOptions
- .files :
string
|Array.<string>
- .source :
string
- .access :
string
- .configure :
string
- .destination :
string
- .encoding :
string
- .private :
boolean
- .package :
string
- .pedantic :
boolean
- .query :
string
- .recurse :
boolean
- .readme :
string
- .template :
string
- .tutorials :
string
- .html :
boolean
- .files :
- ~JsdocOptions
- static
Returns jsdoc explain output.
Kind: static method of jsdoc-api
Prerequisite: Requires node v0.12 or above
Param | Type |
---|---|
[options] | JsdocOptions |
Returns a promise for the jsdoc explain output.
Kind: static method of jsdoc-api
Fulfil: object[]
- jsdoc explain output
Param | Type |
---|---|
[options] | JsdocOptions |
Returns a duplex stream, into which you can pipe source code and receive explain output at the other end.
Kind: static method of jsdoc-api
Param | Type |
---|---|
[options] | JsdocOptions |
Example
fs.createReadStream('source-code.js')
.pipe(jsdoc.createExplainStream())
.pipe(process.stdout)
Render jsdoc documentation.
Kind: static method of jsdoc-api
Prerequisite: Requires node v0.12 or above
Param | Type |
---|---|
[options] | JsdocOptions |
Example
jsdoc.renderSync({ files: 'lib/*', destination: 'api-docs' })
Clean the cache.
Kind: static method of jsdoc-api
The jsdoc options, common for all operations.
Kind: inner class of jsdoc-api
- ~JsdocOptions
- .files :
string
|Array.<string>
- .source :
string
- .access :
string
- .configure :
string
- .destination :
string
- .encoding :
string
- .private :
boolean
- .package :
string
- .pedantic :
boolean
- .query :
string
- .recurse :
boolean
- .readme :
string
- .template :
string
- .tutorials :
string
- .html :
boolean
- .files :
One or more filenames to process. Either this or source
must be supplied.
Kind: instance property of JsdocOptions
A string containing source code to process. Either this or source
must be supplied.
Kind: instance property of JsdocOptions
Only display symbols with the given access: "public", "protected", "private" or "undefined", or "all" for all access levels. Default: all except "private".
Kind: instance property of JsdocOptions
The path to the configuration file. Default: path/to/jsdoc/conf.json.
Kind: instance property of JsdocOptions
The path to the output folder. Use "console" to dump data to the console. Default: ./out/.
Kind: instance property of JsdocOptions
Assume this encoding when reading all source files. Default: utf8.
Kind: instance property of JsdocOptions
Display symbols marked with the @private tag. Equivalent to "--access all". Default: false.
Kind: instance property of JsdocOptions
The path to the project's package file. Default: path/to/sourcefiles/package.json
Kind: instance property of JsdocOptions
Treat errors as fatal errors, and treat warnings as errors. Default: false.
Kind: instance property of JsdocOptions
A query string to parse and store in jsdoc.env.opts.query. Example: foo=bar&baz=true.
Kind: instance property of JsdocOptions
Recurse into subdirectories when scanning for source files and tutorials.
Kind: instance property of JsdocOptions
The path to the project's README file. Default: path/to/sourcefiles/README.md.
Kind: instance property of JsdocOptions
The path to the template to use. Default: path/to/jsdoc/templates/default.
Kind: instance property of JsdocOptions
Directory in which JSDoc should search for tutorials.
Kind: instance property of JsdocOptions
Enable experimental parsing of .html
files.
Kind: instance property of JsdocOptions
© 2015-16 Lloyd Brookes <[email protected]>. Documented by jsdoc-to-markdown.