These options control TypeDoc's output.
// typedoc.json
{
"outputs": [
{
"name": "html",
"path": "./docs_html"
},
{
"name": "html",
"path": "./docs_html_full_nav",
"options": {
"navigation": {
"includeCategories": true,
"includeGroups": true,
"excludeReferences": false,
"includeFolders": true
}
}
},
{
"name": "json",
"path": "./docs.json"
},
{
// requires typedoc-plugin-markdown
"name": "markdown",
"path": "./docs_markdown"
}
]
}
Specifies the outputs which should be rendered by TypeDoc. Outputs specify the name of the output type, a path to render it to, and optionally a set of options to be set when rendering the output.
The output types which ship with TypeDoc by default are html
and json
. Note
that any option may be set in the options
key, but if the option is used
during conversion rather than output it will have no effect when rendering the
output.
$ typedoc --out <path/to/documentation/>
Specifies the location the default output type should be written to. By default, this will cause TypeDoc to generate HTML documentation, but this option may be used by plugins (like typedoc-plugin-markdown) which change the default output type.
This option is an output shortcut. If specified, the outputs option will be overwritten by this option and any other specified output shortcuts.
$ typedoc --html <path/to/documentation/>
Specifies the location the html documentation should be written to. The HTML output produced by running TypeDoc on itself can be seen at TypeDoc API
This option is an output shortcut. If specified, the outputs option will be overwritten by this option and any other specified output shortcuts.
This entire site is generated using TypeDoc's external document support to include markdown documents alongside the API documentation.
$ typedoc --json <path/to/out-file.json>
Specifies the location to output a JSON file containing all of the reflection data. An example of the JSON output from running TypeDoc on itself can be seen at /media/docs.json.
This option is an output shortcut. If specified, the outputs option will be overwritten by this option and any other specified output shortcuts.
$ typedoc --json out.json --pretty
Tells TypeDoc to pretty-format the JSON output. Defaults to true.
$ typedoc --emit none
Instructs TypeDoc to write compiled output files as tsc
does.
Value | Behavior |
---|---|
docs |
Emit documentation, but not JS (default). |
both |
Emit both documentation and JS. |
none |
Emit nothing, just convert and run validation. |
Note: TypeScript is configured with
declaration: true
(throughtsconfig.json
), the TypeDoc emitboth
option will also generate type declaration files.
$ typedoc --theme default
Specify the theme name that should be used.
$ typedoc --lightHighlightTheme light-plus
Specify the Shiki theme to be used to highlight code snippets in light mode.
$ typedoc --darkHighlightTheme dark-plus
Specify the Shiki theme to be used to highlight code snippets in dark mode.
Specifies the Shiki grammars to load for highlighting code blocks. By default, TypeDoc loads the following languages.
{
"highlightLanguages": [
"bash",
"console",
"css",
"html",
"javascript",
"json",
"jsonc",
"json5",
"tsx",
"typescript"
]
}
Specifies the width at which to wrap code when rendering types, defaults to 80. Changing this is not advised without tweaks to the theme in use.
typedoc --typePrintWidth 120
$ typedoc --customCss ./theme/style.css
Specifies an extra CSS file that should be copied into the assets directory and referenced by the theme.
$ typedoc --customJs ./theme/custom.js
Specifies a JavaScript script (not module) file that should be copied into the assets directory and referenced by the theme.
$ typedoc --customFooterHtml "Copyright <strong>Project</strong> 2024"
Specifies additional custom HTML which should be injected into the page footer.
$ typedoc --customFooterHtml "<p>Copyright <strong>Project</strong> 2024</p>" --customFooterHtmlDisableWrapper
By default, TypeDoc will wrap the custom footer HTML in a <p>
element to allow plain text added
with it to show up properly aligned. This option disables the wrapping.
Specifies the options that are forwarded to markdown-it when parsing doc comments. By default TypeDoc overrides the default values used by markdown-it with the ones shown below:
{
"markdownItOptions": {
"html": true,
"linkify": true
}
}
See the options section in the markdown-it readme for a full list of available options.
Function which can be set in a JS config file to configure plugins loaded by markdown-it
. It will be called with an
instance of the MarkdownIt
class.
// typedoc.config.mjs
export default {
markdownItLoader(parser) {
parser.use(plugin1);
},
};
$ typedoc --basePath ./ --entryPoints src/index.ts
Specifies the base path to be used when displaying file paths. If not set, TypeDoc will guess by taking the lowest
common directory to all source files. In the above example, TypeDoc would display links to index.ts
rather than src/index.ts
.
Note: This option only affects displayed paths. It does not affect where TypeDoc will create links to.
$ typedoc --cname typedoc.org
Create a CNAME file in the output directory with the specified text.
$ typedoc --favicon favicon.ico
Specify a .ico
, .png
or .svg
file to reference as the site favicon.
$ typedoc --sourceLinkExternal
Treat source links as external links that open in a new tab when generating HTML.
$ typedoc --markdownLinkExternal
Specifies that http[s]://
links in comments and markdown files should be
treated as external links to be opened in a new tab
$ typedoc --lang zh
Sets the lang
attribute in TypeDoc's HTML output and the translations used when,
generating documentation. Defaults to en
, resulting in <html lang="en">
.
// typedoc.json
{
"locales": {
"zh": {
"flag_private": "私有"
}
}
}
Specify translations which TypeDoc will used when --lang
is set to the specified locale.
See translatable.ts
for a list of all potentially translated messages within TypeDoc.
If your translations may be generally useful to the community, please consider submitting a pull request adding them to TypeDoc!
$ typedoc --githubPages false
When enabled, automatically add a .nojekyll
file to the output directory to prevent GitHub Pages
from processing your documentation site using Jekyll. If you have scoped packages, TypeDoc
generates HTML files that start with _
which are ignored by Jekyll. Defaults to true
.
$ typedoc --cacheBust
When enabled, TypeDoc will include the generation time in <script>
and <link>
tags to JS/CSS assets
to prevent assets from a previous build of the documentation from being used. This should generally not
be necessary with a properly configured web server.
$ typedoc --hideGenerator
Do not print the TypeDoc link at the end of the page. Defaults to false.
$ typedoc --searchInComments
Enables searching comment text in the generated documentation site.
Note: Enabling this option will increase the size of your search index, potentially up to an order of magnitude larger in projects with many long comments.
$ typedoc --searchInDocuments
Enables searching document text in the generated documentation site.
Note: Enabling this option will increase the size of your search index, potentially up to an order of magnitude larger in projects with many documents.
$ typedoc --cleanOutputDir false
Can be used to prevent TypeDoc from cleaning the output directory specified with --out
.
$ typedoc --titleLink "http://example.com"
Sets the link the title in the header points to. Defaults to the documentation homepage.
// typedoc.json
{
"navigationLinks": {
"Example": "http://example.com"
}
}
Defines additional links to be included in the page header.
// typedoc.json
{
"sidebarLinks": {
"Example": "http://example.com"
}
}
Defines additional links to be included in the page sidebar.
// typedoc.json
{
"navigation": {
"includeCategories": true,
"includeGroups": false,
"includeFolders": true,
"compactFolders": false,
"excludeReferences": true
},
"categorizeByGroup": false
}
Determines how the left hand side navigation will be built.
The categorizeByGroup option also affects
this behavior. If set (the default), and includeGroups
is not set, the value
of includeCategories
will be effectively ignored since categories will be
created only within groups.
Also determines if project "folders" should become nested dropdowns in the
navigation pane. This option will only have an effect if your project includes
multiple entry points in different folders. navigation.includeFolders
defaults
to true
.
The includeCategories
and includeGroups
option can be
overwritten on a per-reflection basis by using the following
tags within the comment for the reflection containing the
categories/groups.
@showGroups
@hideGroups
@showCategories
@hideCategories
// typedoc.json
{
"headings": {
"readme": true,
"document": false
}
}
Defines whether a heading describing the reflection should be included on the rendered page.
// typedoc.json
{
"sluggerConfiguration": {
"lowercase": true
}
}
Determines how anchors within a page are created. This option exists primarily
for backwards compatibility. It may be removed in a future release. TypeDoc 0.26
did not lowercase headings within a page which is inconsistent with how GitHub
pages sites commonly generate headings and does not play well with VSCode's
autocomplete to anchors within external markdown files. In 0.27, this option
defaults to true
.
// typedoc.json
{
"navigationLeaves": ["JSONOutput"]
}
Specifies namespaces/modules which should not be expandable in the navigation tree.
To specify a nested namespace, separate the parent names with .
according to the displayed
tree, skipping the top level project link. ParentNS.ChildNS
// typedoc.json
{
"visibilityFilters": {
"protected": false,
"private": false,
"inherited": true,
"external": false,
"@alpha": false,
"@beta": false
}
}
Specifies the available filters when viewing a page. The four protected
, private
, inherited
, and
external
options are all shown by default. Their default value may be set, or they may be omitted
from this option to disable that filter. Further, modifier tags may be specified to introduce a custom
sort option based on a tag.
// typedoc.json
{
"searchCategoryBoosts": {
"Common Items": 1.5
}
}
Configure the search to increase the relevance of items in a given category.
// typedoc.json
{
"searchCategoryBoosts": {
"Classes": 1.5
}
}
Configure the search to increase the relevance of items in a given group.
// typedoc.json
{
"hostedBaseUrl": "https://example.com"
}
Specify the base URL which the TypeDoc generated site will be hosted at. This
is used to generate a sitemap, generate canonical <link>
tags, and enable the
useHostedBaseUrlForAbsoluteLinks option.
// typedoc.json
{
"hostedBaseUrl": "https://example.com",
"useHostedBaseUrlForAbsoluteLinks": true
}
If set, TypeDoc will generate absolute links to pages rather than relative links. Defaults to false.
// typedoc.json
{
"useFirstParagraphOfCommentAsSummary": true
}
When rendering a module or namespace, TypeDoc includes a "short summary" in the
page for each member which is rendered on another page. If the
@summary
tag is used, it will specify the short summary
text. If @summary
is not used, this option controls whether TypeDoc will use
the first paragraph from the comment as the short summary or leave it blank.