Created
November 2, 2021 02:49
-
-
Save sayuj1/d549565158cf2db85ea9436ef8c24360 to your computer and use it in GitHub Desktop.
JS Doc Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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