sharp
sharp copied to clipboard
Docs: improve use of JSDoc
The sharp source code and therefore its API is already relatively well documented using JSDoc, but we can always improve.
Commit https://github.com/lovell/sharp/commit/ef849fd63907d937afce0d06b07ae778692ec500 switched the logic to generate markdown documentation for the API from documentationjs to the better-maintained jsdoc2md. This took a very basic approach to migration and didn't touch any source files, however there are future possible improvements we can now take advantage of.
- Generate a single abstract syntax tree (AST) from all source files, then write multiple output files by filtering this AST by source file.
- Add
@module
,@class
,@memberOf
etc. annotions for correct inheritance and return types, to help prevent the "global" label. - Add
@chainable
annotations where relevant, which is an extension of JSDoc supported by jsdoc-parse. - Caption all code examples via
@example <caption>Explain the example here</caption>
.