Installations
npm install docusaurus-plugin-typedoc-api
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>=16.12.0
Node Version
20.15.0
NPM Version
lerna/7.4.2/node@v20.15.0+arm64 (darwin)
Releases
docusaurus-plugin-typedoc-api@4.4.0
Published on 08 Sept 2024
website@0.6.0
Published on 08 Sept 2024
docusaurus-plugin-typedoc-api@4.3.0
Published on 02 Sept 2024
docusaurus-plugin-typedoc-api@4.2.1
Published on 04 Aug 2024
website@0.5.2
Published on 04 Aug 2024
docusaurus-plugin-typedoc-api@4.2.0
Published on 11 Feb 2024
Contributors
Unable to fetch Contributors
Languages
TypeScript (92.82%)
CSS (4.8%)
MDX (1.82%)
JavaScript (0.56%)
Developer
milesj
Download Statistics
Total Downloads
234,227
Last Day
141
Last Week
882
Last Month
4,193
Last Year
105,021
GitHub Statistics
72 Stars
311 Commits
28 Forks
6 Watching
6 Branches
12 Contributors
Bundle Size
5.82 MB
Minified
1.37 MB
Minified + Gzipped
Sponsor this package
Package Meta Information
Latest Version
4.4.0
Package Id
docusaurus-plugin-typedoc-api@4.4.0
Unpacked Size
482.03 kB
Size
103.11 kB
File Count
281
NPM Version
lerna/7.4.2/node@v20.15.0+arm64 (darwin)
Node Version
20.15.0
Publised On
08 Sept 2024
Total Downloads
Cumulative downloads
Total Downloads
234,227
Last day
5.2%
141
Compared to previous day
Last week
37.2%
882
Compared to previous week
Last month
-11.5%
4,193
Compared to previous month
Last year
44.1%
105,021
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
docusaurus-plugin-typedoc-api
A Docusaurus plugin for generating source code /api/*
routes, powered by
TypeDoc.
The plugin has been designed to document your public API by default (anything exported from a package's entry point), so any private, protected, or internal code will not be generated.
Requirements
typescript
>= v4@docusaurus/core
>= v2.0.0@docusaurus/preset-classic
>= v2.0.0
Examples
Installation
yarn add --dev docusaurus-plugin-typedoc-api
Open your docusaurus.config.js
and make the following changes:
- Add a link to the API route under
themeConfig.navbar.items
andthemeConfig.footer.links
(if desired).
1module.exports = { 2 // ... 3 themeConfig: { 4 // ... 5 navbar: { 6 // ... 7 items: [ 8 // ... 9 { 10 to: 'api', 11 label: 'API', 12 position: 'left', 13 }, 14 ], 15 }, 16 }, 17};
- Configure the plugin in your
plugins
list. TheprojectRoot
andpackages
options are required.
1module.exports = { 2 // ... 3 plugins: [ 4 [ 5 'docusaurus-plugin-typedoc-api', 6 { 7 projectRoot: path.join(__dirname, '..'), 8 // Monorepo 9 packages: ['packages/example', 'packages/other'], 10 // Polyrepo 11 packages: ['.'], 12 }, 13 ], 14 ], 15};
Configuration
The following options are available to the plugin:
projectRoot
(string
) - Absolute path to the project root wheretsconfig.json
is located. (Required)packages
((string | PackageConfig)[]
) - List of packages relative to the project root. (Required)banner
(string
) - Banner message to display at the top of the index page. Supports HTML.changelogName
(string
) - Name of the changelog file within a package. Defaults toCHANGELOG.md
.changelogs
(boolean
) - Include and render the changelog file from every package. Defaults tofalse
.exclude
(string[]
) - List of glob patterns to exclude unwanted packages. This is necessary when using TypeScript project references.gitRefName
(string
) - GitHub repository ref name to point the API links to. Defaults tomaster
.minimal
(boolean
) - Render a minimal layout and reduce the amount of information displayed. Defaults tofalse
.packageJsonName
(string
) - Name of thepackage.json file
. Defaults topackage.json
.readmeName
(string
) - Name of the readme file within a package. Defaults toREADME.md
.readmes
(boolean
) - Include and render the readme file from every package. Defaults tofalse
.rehypePlugins
(MDXPlugin[]
) - List of rehype plugins to use for MDX compilation.remarkPlugins
(MDXPlugin[]
) - List of remark plugins to use for MDX compilation.removeScopes
(string[]
) - Package scopes and prefixes to remove when displaying the package name in the sidebar and index. For example,boost
will remove@boost/
andboost-
.sortPackages
((a, d) => number
) - Function to sort the package list in the sidebar and on the index page. Defaults to alphabetical.sortSidebar
((a, d) => number
) - Function to sort the categories and items within each sidebar, excluding "Overview" and "Changelog". Defaults to alphabetical.tsconfigName
(string
) - Name of the TypeScript config file in the project root. Defaults totsconfig.json
.typedocOptions
(object
) - TypeDoc options to pass to the compiler. Only supports a small subset of options, primarily around visibility exclusion.
Packages
The packages
option has been designed to support multiple packages, with multiple entry points per
package. By default the option accepts a list of strings, where each value is a relative path to a
package folder, and a default entry point of src/index.ts
.
1module.exports = { 2 packages: ['packages/core', 'packages/react'], 3};
However, an object can be provided to customize the entry point. All entry point file paths are relative to the package folder, and support 2 formats:
- Index imports - Consumers can only import from the package index. This is typically an entry
point like
src/index.ts
. - Deep imports - Consumers can import anything from the package using its file path. Glob the
entire package by only passing the folder name like
src/
. (This is useful for component libraries)
1module.exports = { 2 packages: [ 3 'packages/core', 4 { 5 path: 'packages/react', 6 // Index only imports allowed 7 // import {} from 'package' 8 entry: 'src/index.tsx', 9 // Deep imports allowed 10 // import {} from 'package/some/nested/file' 11 entry: 'src/', 12 }, 13 ], 14};
When not using deep imports, multiple entry points can be defined by passing a map of objects to
entry
, where each key is a sub-path that can be imported from the package (excluding the index
).
Each entry object requires a path
and a label
, which is used for categorizing and sidebars.
1module.exports = { 2 packages: [ 3 'packages/core', 4 { 5 path: 'packages/react', 6 entry: { 7 // import {} from 'package' 8 index: 'src/index.tsx', 9 // import {} from 'package/client' 10 client: { path: 'src/client.tsx', label: 'Client' }, 11 // import {} from 'package/server' 12 server: { path: 'src/server.tsx', label: 'Server' }, 13 // import {} from 'package/server/test' 14 'server/test': { path: 'src/server/test-utils.tsx', label: 'Server test utils' }, 15 }, 16 }, 17 ], 18};
Index entry points don't require a label, so a file path can be passed directly.
Linking
This plugin supports API and documentation linking within source code docblocks via the @apilink
and @doclink
tokens respectively. This works in a similar fashion to
TypeDoc's @link
resolution, but also supports
Docusaurus versioning and routing patterns.
@apilink
When linking to other APIs, you must reference them by class name, function name, property, etc,
instead of the actual /api
route.
1# Maps to /api/<package>/class/Registry#register 2{@apilink Registry.register} 3{@apilink Registry.register | Text to use as the label}
@doclink
When linking to documentation pages, you must reference the article by its URL identifier without
the /docs
prefix.
1# Maps to /docs/commands/setup 2{@doclink commands/setup} 3{@doclink commands/setup | Text to use as the label}
Versioning
This plugin supports API versioning by piggy-backing off the built-in docs versioning implementation, which is a requirement for this to work correctly.
To begin, version your docs with the built-in command:
1yarn docusaurus docs:version 1.2.3
Once the markdown files are generated, run our versioning command with the same version used previously:
1yarn docusaurus api:version 1.2.3
This will create multiple JSON files in the versioned_docs/version-1.2.3
directory. Be sure to
commit these files to your repo.
When versioning, the current state of your branch will be used as that version's API. To update/regenerate old versions, you'll need to checkout an old commit, re-version, and copy the generated files to the latest branch.
Navigation
Our API is unable to use the
docsVersionDropdown
navigation type, as it's hardcoded in Docusaurus core. However, you can create a custom version
dropdown like so:
1const versions = require('./versions.json'); 2 3module.exports = { 4 // ... 5 themeConfig: { 6 // ... 7 navbar: { 8 // ... 9 items: [ 10 // ... 11 { 12 type: 'dropdown', 13 to: 'api', 14 label: 'API', 15 position: 'left', 16 items: [ 17 { label: 'Next', to: 'api/next' }, 18 ...versions.map((version, i) => ({ 19 label: version, 20 to: i === 0 ? 'api' : `api/${version}`, 21 })), 22 ], 23 }, 24 ], 25 }, 26 }, 27};
This workaround isn't perfect and may be buggy. Use at your own risk!
Sidebars
When we generate API routes, we also dynamically generate and associate a sidebar with each route. This cannot be overridden, but can be customized with some basic options (like categories and sorting).
If you'd like to reference the generated sidebar in your sidebars.ts
, we write the sidebar to a
file located at .docusaurus/api-sidebar-<id>-<version>.js
. The <id>
token defaults to "default"
and <version>
to "current".
1import apiSidebar from './.docusaurus/api-sidebar-default-current'; 2 3export default { 4 api: apiSidebar, 5};
Caveats
- Each version in
versioned_docs
(orversions.json
) must contain the generated API JSON files, otherwise the build will fail. - The header/footer API links are not version aware, as their values are static.
- We suggest only versioning major versions, as the size of these JSON files and the webpack build will get very large very fast.
Comparison
There's another plugin called
docusaurus-plugin-typedoc,
that offers a similar solution. However, there are many differences between that package and this
one, with the biggest being that theirs generates markdown files and /docs/api/...
styled routes,
while ours renders custom React pages with /api/...
styled routes. Some other differences are:
- An index of all packages.
- Readme inclusion and rendering.
- Custom styles, sections, and headings.
- Multiple function and method signatures.
- Versioning!
- And probably more....
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
Found 7/20 approved changesets -- score normalized to 3
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/build.yml:1
- Warn: no topLevel permission defined: .github/workflows/pr.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/milesj/docusaurus-plugin-typedoc-api/build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/milesj/docusaurus-plugin-typedoc-api/build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/milesj/docusaurus-plugin-typedoc-api/build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/milesj/docusaurus-plugin-typedoc-api/build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/milesj/docusaurus-plugin-typedoc-api/build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/milesj/docusaurus-plugin-typedoc-api/build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/milesj/docusaurus-plugin-typedoc-api/pr.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/milesj/docusaurus-plugin-typedoc-api/pr.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/pr.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/milesj/docusaurus-plugin-typedoc-api/pr.yml/master?enable=pin
- Info: 0 out of 8 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 22 are checked with a SAST tool
Reason
27 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-8hc4-vh64-cxmj
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
2.5
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to docusaurus-plugin-typedoc-api
@apify/docusaurus-plugin-typedoc-api
Docusaurus plugin that provides source code API documentation powered by TypeDoc.
@jiereal/docusaurus-plugin-typedoc
A Docusaurus v2 plugin to build API documentation with TypeDoc.
@mpetrunic/docusaurus-plugin-typedoc-api
Docusaurus plugin that provides source code API documentation powered by TypeDoc.
@memlab/memlab-docusaurus-plugin-typedoc
This is a fork of docusaurus-plugin-typedoc