Skip to content

Commit 7a48a17

Browse files
committed
Document additional changes
1 parent 3343cc4 commit 7a48a17

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# Unreleased
22

3+
### Features
4+
5+
- Added `Application.EVENT_VALIDATE_PROJECT` event for plugins which implement custom validation, #2183.
6+
- Plugins may now return an object from external symbol resolvers, #2066.
7+
38
### Bug Fixes
49

510
- Fix crash when converting `export default undefined`, #2175
611

712
### Thanks!
813

14+
- @captain-torch
915
- @loopingz
16+
- @RebeccaStevens
1017

1118
## v0.23.25 (2023-02-11)
1219

internal-docs/third-party-symbols.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,58 @@ export function load(app: Application) {
9696
});
9797
}
9898
```
99+
100+
Since TypeDoc 0.23.26, plugins may also return return an object for more control
101+
over the displayed link. The returned `caption` will be used if the user does not
102+
specify the link text.
103+
104+
```ts
105+
import { Application, type DeclarationReference } from "typedoc";
106+
107+
const documentedExports = [
108+
"chunk",
109+
"compact",
110+
"concat",
111+
"difference",
112+
"differenceBy",
113+
"differenceWith",
114+
];
115+
116+
export function load(app: Application) {
117+
app.converter.addUnknownSymbolResolver((ref: DeclarationReference) => {
118+
if (
119+
// TS defined symbols
120+
ref.moduleSource !== "@types/lodash" &&
121+
// User {@link} tags
122+
ref.moduleSource !== "lodash"
123+
) {
124+
return;
125+
}
126+
127+
// If someone did {@link lodash!}, link them directly to the home page.
128+
if (!ref.symbolReference) {
129+
return "https://lodash.com/";
130+
}
131+
132+
if (!ref.symbolReference.path) {
133+
// Someone included a meaning, but not a path.
134+
// https://typedoc.org/guides/declaration-references/#meaning
135+
return;
136+
}
137+
138+
if (ref.symbolReference.path.length === 1) {
139+
const name = ref.symbolReference.path[0].path;
140+
if (documentedExports.includes(name)) {
141+
return {
142+
target: `https://lodash.com/docs/4.17.15#${name}`,
143+
caption: name,
144+
};
145+
}
146+
}
147+
});
148+
}
149+
```
150+
151+
The unknown symbol resolver will also be passed the reflection containing the link
152+
and, if the link was defined by the user, the [CommentDisplayPart](https://typedoc.org/api/types/CommentDisplayPart.html)
153+
which was parsed into the `DeclarationReference` provided as the first argument.

0 commit comments

Comments
 (0)