aboutsummaryrefslogtreecommitdiff
path: root/scripts/apidoc/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/apidoc/utils.ts')
-rw-r--r--scripts/apidoc/utils.ts23
1 files changed, 14 insertions, 9 deletions
diff --git a/scripts/apidoc/utils.ts b/scripts/apidoc/utils.ts
index 651a0119..ef26a67d 100644
--- a/scripts/apidoc/utils.ts
+++ b/scripts/apidoc/utils.ts
@@ -112,15 +112,20 @@ export function extractRawExamples(signature?: SignatureReflection): string[] {
* @param signature The signature to extract the see also references from.
*/
export function extractSeeAlsos(signature?: SignatureReflection): string[] {
- return extractTagContent('@see', signature, (tag) => {
- const content = tag.content;
- if (content.length === 1) {
- return joinTagContent(tag);
- }
- return tag.content
- .filter((_, index) => index % 3 === 1) // ['-', 'content', '\n']
- .map((part) => part.text);
- });
+ return extractTagContent('@see', signature, (tag) =>
+ // If the @see tag contains code in backticks, the content is split into multiple parts.
+ // So we join together, split on newlines and filter out empty tags.
+ joinTagParts(tag.content)
+ .split('\n')
+ .map((link) => {
+ link = link.trim();
+ if (link.startsWith('-')) {
+ link = link.slice(1).trim();
+ }
+ return link;
+ })
+ .filter((link) => link)
+ );
}
/**