Skip to content

Instantly share code, notes, and snippets.

@sayuj1
Created November 2, 2021 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sayuj1/d549565158cf2db85ea9436ef8c24360 to your computer and use it in GitHub Desktop.
Save sayuj1/d549565158cf2db85ea9436ef8c24360 to your computer and use it in GitHub Desktop.
JS Doc Configuration
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
},
"source": {
"include": ["src"],
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"plugins": ["plugins/markdown", "better-docs/component"],
"templates": {
"better-docs": {
"name": "My React components"
}
},
"opts": {
"destination": "docs",
"recurse": true,
"readme": "README.md"
}
}
To generate HTML from our comments, we need to use jsdoc npm package
We can install it using
$ npm i jsdoc
We'll also need to install better-docs plugin for jsdocs.
$ npm i better-docs
Then we need to create a config file
$ touch jsdoc.conf.json
now add the configuration options in the file
You can create an npm script that can generate the documentation for you
...
"scripts": {
...
"docs": "jsdoc -c jsdoc.conf.json"
...
}
...
At last, you can generate the documentation with the following command
npm run docs
Now the documentation can be found in the /docs directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment