Quick Start
Docusaurus Plugin (Recommended)
For fully integrated setup with Docusaurus, we recommend using the Docusaurus plugin docusaurus-plugin-typedoc
.
This will allow you to run TypeDoc with required plugins and preset options as part of the Docusaurus build process.
Installation
Install Docusaurus in the root of your project and install the plugin dependencies in the same location as the Docusaurus website directory.
npm install typedoc typedoc-plugin-markdown docusaurus-plugin-typedoc --save-dev
Usage
Create a Docusaurus project
https://docusaurus.io/docs/installation
A typical project structure might look like this but can be customized to your needs:
- docusaurus.config.js
- package.json
- sidebars.js
- package.json
- tsconfig.json
Add the plugin to docusaurus.config.js
Add the plugin to docusaurus.config.js
and specify the required options.
The following options can be passed to the config:
module.exports = {
// Add option types
plugins: [
[
'docusaurus-plugin-typedoc',
// Options
{
entryPoints: ['../src/index.ts'],
tsconfig: '../tsconfig.json',
},
],
],
};
Run Docusaurus
You can generate the docs by either:
- Running Docusaurus by using the
start
orbuild
cli commands . - Building the docs independently by running the custom cli command
docusaurus generate-typedoc
and then running Docusaurus at another time.
View the docs
Once built the docs will be available at /docs/api
(or equivalent output directory).
e.g. http://localhost:3000/docs/api
Standalone
If you would prefer to generate your docs entirely independently of a Docusaurus project (for later integration) you can run the typedoc-docusaurus-theme
TypeDoc plugin independently.
Install
npm install typedoc typedoc-plugin-markdown typedoc-docusaurus-theme --save-dev
Usage
{
"plugin": ["typedoc-plugin-markdown", "typedoc-docusaurus-theme"]
}
npm run typedoc