Getting JSDoc output in JSON format

2019-07-04 01:15发布

问题:

Is there any way to configure JSDoc such that the output is in JSON format instead of the usual HMTL format?

回答1:

There is an option "-X" ("explain") which creates a JSON file with parsed AST.

jsdoc -X ./mylib/ > jsdoc-ast.json

To understand this JSON you can use documented schema: https://github.com/jsdoc3/jsdoc/blob/master/lib/jsdoc/schema.js