Skip to content

Commit 8f1c186

Browse files
committed
Split site up similarly to 0.26 site
1 parent 39baf4a commit 8f1c186

14 files changed

+315
-91
lines changed

.config/typedoc.json

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
"categorizeByGroup": false,
3737
"categoryOrder": ["Reflections", "Types", "Comments", "*"],
3838
"groupOrder": ["Common", "*"],
39+
"navigationLinks": {
40+
"Docs": "https://typedoc.org",
41+
"Example": "https://typedoc.org/example/index.html",
42+
"GitHub": "https://github.com/TypeStrong/typedoc"
43+
},
3944
"validation": {
4045
"notExported": true,
4146
"invalidLink": true,

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"eslint.workingDirectories": [".", "./example"],
4343
"mochaExplorer.configFile": ".config/mocha.test-explorer.json",
4444
// Ignore usernames in the Thanks sections of the changelog
45-
"cSpell.ignoreRegExpList": ["/^- +@[A-Z0-9_]+/igm"],
45+
"cSpell.ignoreRegExpList": ["/^- +@[A-Z0-9_-]+/igm"],
4646
"cSpell.words": [
4747
"callouts",
4848
"cname",
@@ -60,6 +60,7 @@
6060
"shiki",
6161
"tsbuildinfo",
6262
"tsdoc",
63+
"typedoc",
6364
"typeof",
6465
"typestrong",
6566
"uncategorized",

example/src/documents/markdown.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ A TypeScript code block:
2929
const x: number | string = 12
3030
```
3131

32-
See {@link syntaxHighlightingShowcase | `syntaxHighlightingShowcase`} for more code blocks.
32+
See [the syntax highlighting showcase](./syntax-highlighting.md) for more code blocks.
3333

3434
## A List
3535

example/typedoc.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
"Classes": 1.5
1313
},
1414
"navigationLinks": {
15-
"Docs": "https://typedoc.org/guides/overview",
15+
"Docs": "https://typedoc.org",
16+
"API": "https://typedoc.org/api/index.html",
1617
"GitHub": "https://github.com/TypeStrong/typedoc"
1718
},
18-
"sidebarLinks": {
19-
"API": "https://typedoc.org/api"
20-
},
2119
"highlightLanguages": [
2220
"typescript",
2321
"tsx",

scripts/build_site.sh

+16-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,26 @@ set -e
55
node bin/typedoc --help --logLevel Error > site/generated/help.txt
66
node scripts/generate_site_plugins.js
77

8-
# Build the API docs, only build JSON output here to remove ~2s from
9-
# the time it takes to run this script.
10-
# node bin/typedoc --json docs/docs.json --readme none
8+
# Build the API docs
9+
if [[ -n "$CI" || ! -d docs ]]; then
10+
node bin/typedoc --html docs --json docs/docs.json --readme none
11+
fi
12+
13+
# Build the example
14+
if [[ -n "$CI" || ! -d example/docs ]]; then
15+
cd example
16+
npm i
17+
npm run typedoc -- --logLevel Error
18+
cd ..
19+
fi
1120

1221
# Build the actual site, references the API docs
1322
node bin/typedoc --options site/typedoc.config.jsonc
1423

1524
# Create/copy static files
1625
node scripts/generate_options_schema.js docs-site/schema.json
26+
# cspell: words googlede
1727
cp site/googlede482cdb17c37ad4.html docs-site/googlede482cdb17c37ad4.html
28+
29+
cp -r example/docs docs-site/example
30+
cp -r docs docs-site/api

site/development/index.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Output is split into two folders, for JSON output see the `src/lib/serialization
3434

3535
Plugins may effect any part of the process after step 2 by listening to events
3636
fired by each component or adding / replacing handlers for a given task. As an
37-
example, the {@link Converter | Converter} fires events before
37+
example, the [Converter](https://typedoc.org/api/classes/Converter.html) fires events before
3838
starting conversion, when declarations are converted and when the project should
3939
be resolved.
4040

@@ -62,7 +62,7 @@ run it with `--help` to see a summary of the available options.
6262

6363
For more detailed information about the implementation and API surface of each
6464
component, consult its API documentation. All components are available on the
65-
{@link Application} class, which is passed to plugins.
65+
[Application](https://typedoc.org/api/classes/Application.html) class, which is passed to plugins.
6666

6767
### Options
6868

@@ -84,9 +84,9 @@ There are 11 builtin option types as specified by the [ParameterType](https://ty
8484
- `GlobArray` - An array of globs. Globs will be resolved if they do not start with `**`, after skipping leading `!` and `#` characters.
8585

8686
Options are discovered and set by option readers, which are documented in the
87-
{@link Configuration.OptionsReader} interface.
87+
[Configuration.OptionsReader](https://typedoc.org/api/interfaces/Configuration.OptionsReader.html) interface.
8888

89-
Plugins can declare their own options by calling {@link Options.addDeclaration}
89+
Plugins can declare their own options by calling [Options.addDeclaration](https://typedoc.org/api/classes/Configuration.Options.html#adddeclaration)
9090

9191
### Plugins
9292

@@ -114,7 +114,10 @@ export function load(app: Application) {
114114

115115
### Converters
116116

117-
TypeDoc converts the syntax tree created by TypeScript into its own structure of {@link Models.Reflection | Reflections} to allow themes and serialization to work with a standard object format. Conversion is done primarily in three files.
117+
TypeDoc converts the syntax tree created by TypeScript into its own structure of
118+
[Reflections](https://typedoc.org/api/classes/Models.Reflection.html) to allow
119+
themes and serialization to work with a standard object format. Conversion is
120+
done primarily in three files.
118121

119122
- [symbols.ts](https://github.com/TypeStrong/typedoc/blob/master/src/lib/converter/symbols.ts) - contains converters for each `ts.Symbol` that is exported from entry points.
120123
- [types.ts](https://github.com/TypeStrong/typedoc/blob/master/src/lib/converter/types.ts) - contains converters for `ts.Type`s and `ts.TypeNode`s.
@@ -123,11 +126,14 @@ TypeDoc converts the syntax tree created by TypeScript into its own structure of
123126
### JSON Output
124127

125128
TypeDoc can produce JSON output which can be consumed by other tools. The format
126-
of this JSON is defined by the {@link JSONOutput.ProjectReflection} interface.
127-
If plugins want to cause custom properties to be included in the output JSON,
128-
they can achieve this by adding a serializer to {@link Serializer }. If custom
129-
properties are added, they should generally also be revived with a {@link
130-
Deserializer} so that they can be used with TypeDoc's packages mode.
129+
of this JSON is defined by the
130+
[JSONOutput.ProjectReflection](https://typedoc.org/api/interfaces/JSONOutput.ProjectReflection.html)
131+
interface. If plugins want to cause custom properties to be included in the
132+
output JSON, they can achieve this by adding a serializer to
133+
[Serializer](https://typedoc.org/api/classes/Serializer.html). If custom
134+
properties are added, they should generally also be revived with a
135+
[Deserializer](https://typedoc.org/api/classes/Deserializer.html) so that they
136+
can be used with TypeDoc's packages mode.
131137

132138
### HTML Output
133139

site/development/internationalization.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ translation keys include numbers to indicate placeholders in the English string,
3939
the translated strings should include `{n}` where the placeholder will be filled in at
4040
runtime.
4141

42+
> [!IMPORTANT]
4243
> Please do not submit machine generated translations for languages you are unfamiliar with.
4344
> TypeDoc relies on contributors to ensure the accuracy of included translations.
4445
@@ -58,8 +59,7 @@ to them as suggested in the example above.
5859

5960
Plugins may use TypeDoc's internationalization module to provide multiple
6061
translations for strings declared within them. To do this, they should call
61-
{@link Internationalization.Internationalization.addTranslations |
62-
Application.internationalization.addTranslations} with their expected values.
62+
[Application.internationalization.addTranslations] with their expected values.
6363

6464
The `addTranslations` method expects that all translatable strings have been
6565
declared in the `TranslatableStrings` interface. To do this, use declaration
@@ -88,3 +88,5 @@ export function load(app: td.Application) {
8888
app.logger.info(app.i18n.plugin_example_hello_0("TypeDoc")); // Logs "Hello TypeDoc!"
8989
}
9090
```
91+
92+
[Application.internationalization.addTranslations]: https://typedoc.org/api/classes/Internationalization.Internationalization.html#addtranslations

site/development/plugins.md

+28-18
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ summary: Overview of how to write a TypeDoc plugin
55

66
# Writing a TypeDoc Plugin
77

8-
TypeDoc supports plugins which can modify how projects are converted, how converted symbols
9-
are organized, and how they are displayed, among other things. Plugins are Node modules which
10-
export a single `load` function that will be called by TypeDoc with the {@link Application} instance
11-
which they are to be attached to. Plugins should assume that they may be loaded multiple times
12-
for different applications, and that a single load of an application class may be used to convert
13-
multiple projects.
8+
TypeDoc supports plugins which can modify how projects are converted, how
9+
converted symbols are organized, and how they are displayed, among other things.
10+
Plugins are Node modules which export a single `load` function that will be
11+
called by TypeDoc with the [Application] instance which they are to be attached
12+
to. Plugins should assume that they may be loaded multiple times for different
13+
applications, and that a single load of an application class may be used to
14+
convert multiple projects.
1415

1516
Plugins may be either ESM or CommonJS.
1617

@@ -24,22 +25,31 @@ export function load(app) {
2425
}
2526
```
2627

27-
Plugins affect TypeDoc's execution by attaching event listeners to one or many events that will be
28-
fired during conversion and rendering. Events are available on the {@link Application}, {@link Converter},
29-
{@link Renderer}, and {@link Serializer}/{@link Deserializer} classes. There are static `EVENT_*` properties on those
30-
classes which describe the available events.
28+
Plugins affect TypeDoc's execution by attaching event listeners to one or many
29+
events that will be fired during conversion and rendering. Events are available
30+
on the [Application], [Converter], [Renderer], and [Serializer]/[Deserializer]
31+
classes. There are static `EVENT_*` properties on those classes which describe
32+
the available events.
3133

32-
The best way to learn what's available to plugins is to browse the docs, or look at the source code
33-
for existing plugins. There is a list of currently supported plugins at https://typedoc.org/guides/plugins/
34+
The best way to learn what's available to plugins is to browse the docs, or look
35+
at the source code for existing plugins. There is a list of currently supported
36+
plugins at https://typedoc.org/guides/plugins/
3437

35-
TypeDoc also provides several control hooks for plugins to change it's behavior, they are described
36-
by the [third party symbols](./third-party-symbols.md) and [custom themes](./themes.md) documents.
38+
TypeDoc also provides several control hooks for plugins to change it's behavior,
39+
they are described by the [third party symbols](./third-party-symbols.md) and
40+
[custom themes](./themes.md) documents.
3741

38-
Plugins which are configurable can add custom options with `app.options.addDeclaration`. [typedoc-plugin-mdn-links]
39-
has an example of the recommended way of doing this.
42+
Plugins which are configurable can add custom options with
43+
`app.options.addDeclaration`. [typedoc-plugin-mdn-links] has an example of the
44+
recommended way of doing this.
4045

41-
If you have specific questions regarding plugin development, please open an issue or ask in the
42-
[TypeScript Discord] #typedoc channel.
46+
If you have specific questions regarding plugin development, please open an
47+
issue or ask in the [TypeScript Discord] #typedoc channel.
4348

4449
[typedoc-plugin-mdn-links]: https://github.com/Gerrit0/typedoc-plugin-mdn-links/blob/main/src/index.ts
4550
[TypeScript Discord]: https://discord.gg/typescript
51+
[Application]: file:///home/gerrit/Desktop/typedoc/docs-site/api/classes/Application.html
52+
[Converter]: file:///home/gerrit/Desktop/typedoc/docs-site/api/classes/Converter.html
53+
[Renderer]: file:///home/gerrit/Desktop/typedoc/docs-site/api/classes/Renderer.html
54+
[Serializer]: file:///home/gerrit/Desktop/typedoc/docs-site/api/classes/Serializer.html
55+
[Deserializer]: file:///home/gerrit/Desktop/typedoc/docs-site/api/classes/Deserializer.html

site/development/themes.md

+19-15
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ export function load(app: Application) {
1616
}
1717
```
1818

19-
This isn't very interesting since it exactly duplicates the default theme.
20-
Most themes need to adjust the templates in some way. This can be done by
21-
providing them class which returns a different context class. Say we wanted
22-
to replace TypeDoc's default footer with one that mentioned your copyright.
23-
This could be done with the following theme.
19+
This isn't very interesting since it exactly duplicates the default theme. Most
20+
themes need to adjust the templates in some way. This can be done by providing
21+
them class which returns a different context class. Say we wanted to replace
22+
TypeDoc's default footer with one that mentioned your copyright. This could be
23+
done with the following theme.
2424

2525
In this case, it would probably be better to add this content using a render
2626
hook for `footer.begin` or `footer.end`, but it can be done in this way as well.
@@ -55,10 +55,11 @@ export function load(app: Application) {
5555

5656
## Hooks
5757

58-
When rendering themes, TypeDoc's default theme will call several functions to allow plugins to inject HTML
59-
into a page without completely overwriting a theme. Hooks live on the parent `Renderer` and may be called
60-
by child themes which overwrite a helper with a custom implementation. As an example, the following plugin
61-
will cause a popup on every page when loaded.
58+
When rendering themes, TypeDoc's default theme will call several functions to
59+
allow plugins to inject HTML into a page without completely overwriting a theme.
60+
Hooks live on the parent `Renderer` and may be called by child themes which
61+
overwrite a helper with a custom implementation. As an example, the following
62+
plugin will cause a popup on every page when loaded.
6263

6364
```tsx
6465
import { Application, JSX } from "typedoc";
@@ -71,15 +72,16 @@ export function load(app: Application) {
7172
}
7273
```
7374

74-
For documentation on the available hooks, see the {@link RendererHooks |
75-
RendererHooks} documentation on the website.
75+
For documentation on the available hooks, see the [RendererHooks] documentation
76+
on the website.
7677

7778
## Async Jobs
7879

79-
Themes which completely override TypeDoc's builtin renderer may need to perform some async initialization
80-
or teardown after rendering. To support this, there are two arrays of functions available on `Renderer`
81-
which plugins may add a callback to. The renderer will call each function within these arrays when rendering
82-
and await the results.
80+
Themes which completely override TypeDoc's builtin renderer may need to perform
81+
some async initialization or teardown after rendering. To support this, there
82+
are two arrays of functions available on `Renderer` which plugins may add a
83+
callback to. The renderer will call each function within these arrays when
84+
rendering and await the results.
8385

8486
```ts
8587
import { Application, RendererEvent } from "typedoc";
@@ -99,3 +101,5 @@ export function load(app: Application) {
99101
});
100102
}
101103
```
104+
105+
[RendererHooks]: https://typedoc.org/api/interfaces/RendererHooks.html

site/development/third-party-symbols.md

+40-26
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,28 @@ title: Third Party Symbols
44

55
# Third Party Symbols
66

7-
TypeDoc 0.22 added support for linking to third party sites by associating a symbol name with npm packages.
8-
9-
Since TypeDoc 0.23.13, some mappings can be defined without a plugin by setting [`externalSymbolLinkMappings`][externalSymbolLinkMappings].
10-
This should be set to an object whose keys are package names, and values are the `.` joined qualified name
11-
of the third party symbol. If the link was defined with a user created declaration reference, it may also
12-
have a `:meaning` at the end. TypeDoc will _not_ attempt to perform fuzzy matching to remove the meaning from
13-
keys if not specified, so if meanings may be used, a url must be listed multiple times.
14-
15-
Global external symbols are supported, but may have surprising behavior. TypeDoc assumes that if a symbol was
16-
referenced from a package, it was exported from that package. This will be true for most native TypeScript packages,
17-
but packages which rely on `@types` will be linked according to that `@types` package for that package name.
18-
19-
Furthermore, types which are defined in the TypeScript lib files (including `Array`, `Promise`, ...) will be
20-
detected as belonging to the `typescript` package rather than the `global` package. In order to support both
21-
`{@link !Promise}` and references to the type within source code, both `global` and `typescript` need to be set.
7+
TypeDoc 0.22 added support for linking to third party sites by associating a
8+
symbol name with npm packages.
9+
10+
Since TypeDoc 0.23.13, some mappings can be defined without a plugin by setting
11+
[`externalSymbolLinkMappings`][externalSymbolLinkMappings]. This should be set
12+
to an object whose keys are package names, and values are the `.` joined
13+
qualified name of the third party symbol. If the link was defined with a user
14+
created declaration reference, it may also have a `:meaning` at the end. TypeDoc
15+
will _not_ attempt to perform fuzzy matching to remove the meaning from keys if
16+
not specified, so if meanings may be used, a url must be listed multiple times.
17+
18+
Global external symbols are supported, but may have surprising behavior. TypeDoc
19+
assumes that if a symbol was referenced from a package, it was exported from
20+
that package. This will be true for most native TypeScript packages, but
21+
packages which rely on `@types` will be linked according to that `@types`
22+
package for that package name.
23+
24+
Furthermore, types which are defined in the TypeScript lib files (including
25+
`Array`, `Promise`, ...) will be detected as belonging to the `typescript`
26+
package rather than the `global` package. In order to support both `{@link
27+
!Promise}` and references to the type within source code, both `global` and
28+
`typescript` need to be set.
2229

2330
```jsonc
2431
// typedoc.json
@@ -54,12 +61,14 @@ A wildcard can be used to provide a fallback link to any unmapped type.
5461
## Plugins
5562

5663
Plugins can add support for linking to third party sites by calling
57-
{@link Converter.addUnknownSymbolResolver | `app.converter.addUnknownSymbolResolver`}
64+
[Converter.addUnknownSymbolResolver]
5865

59-
If the given symbol is unknown, or does not appear in the documentation site, the resolver may return `undefined`
60-
and no link will be rendered unless provided by another resolver.
66+
If the given symbol is unknown, or does not appear in the documentation site,
67+
the resolver may return `undefined` and no link will be rendered unless provided
68+
by another resolver.
6169

62-
The following plugin will resolve a few types from React to links on the official React documentation site.
70+
The following plugin will resolve a few types from React to links on the
71+
official React documentation site.
6372

6473
```ts
6574
import { Application, type DeclarationReference } from "typedoc";
@@ -106,8 +115,8 @@ export function load(app: Application) {
106115
```
107116

108117
Since TypeDoc 0.23.26, plugins may also return return an object for more control
109-
over the displayed link. The returned `caption` will be used if the user does not
110-
specify the link text.
118+
over the displayed link. The returned `caption` will be used if the user does
119+
not specify the link text.
111120

112121
```ts
113122
import { Application, type DeclarationReference } from "typedoc";
@@ -156,11 +165,16 @@ export function load(app: Application) {
156165
}
157166
```
158167

159-
The unknown symbol resolver will also be passed the reflection containing the link
160-
and, if the link was defined by the user, the {@link Models.CommentDisplayPart} which was parsed into the
161-
{@link DeclarationReference} provided as the first argument.
168+
The unknown symbol resolver will also be passed the reflection containing the
169+
link and, if the link was defined by the user, the [Models.CommentDisplayPart]
170+
which was parsed into the [DeclarationReference] provided as the first argument.
162171

163-
If `--useTsLinkResolution` is on (the default), it may also be passed a {@link Models.ReflectionSymbolId}
164-
referencing the symbol that TypeScript resolves the link to.
172+
If `--useTsLinkResolution` is on (the default), it may also be passed a
173+
[Models.ReflectionSymbolId] referencing the symbol that TypeScript resolves the
174+
link to.
165175

166176
[externalSymbolLinkMappings]: https://typedoc.org/options/comments/#externalsymbollinkmappings
177+
[Converter.addUnknownSymbolResolver]: https://typedoc.org/api/classes/Converter.html#addUnknownSymbolResolver
178+
[Models.CommentDisplayPart]: https://typedoc.org/api/types/Models.CommentDisplayPart.html
179+
[DeclarationReference]: https://typedoc.org/api/interfaces/DeclarationReference.html
180+
[Models.ReflectionSymbolId]: https://typedoc.org/api/classes/Models.ReflectionSymbolId.html

0 commit comments

Comments
 (0)