From 56943a72f4be9c24d55ec8ebabfccc2abd3e384f Mon Sep 17 00:00:00 2001 From: brynpttrsn Date: Sat, 3 Feb 2024 17:10:28 -0500 Subject: [PATCH] fix(website): resolve linkTags in meta description (#10088) * fix(website): resolve linkTags in summaries * fix: case body as block * fix: add discord-api-types support * fix: remove urlDestination when undefined * fix: breaks to if/else --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/scripts/src/generateIndex.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/scripts/src/generateIndex.ts b/packages/scripts/src/generateIndex.ts index 7466587c8..db952ab40 100644 --- a/packages/scripts/src/generateIndex.ts +++ b/packages/scripts/src/generateIndex.ts @@ -60,9 +60,24 @@ export function tryResolveSummaryText(item: ApiDeclaredItem): string | null { case DocNodeKind.PlainText: retVal += (node as DocPlainText).text; break; - case DocNodeKind.LinkTag: - retVal += (node as DocLinkTag).urlDestination; + case DocNodeKind.LinkTag: { + const { codeDestination, urlDestination, linkText } = node as DocLinkTag; + if (codeDestination) { + const declarationReference = item.getAssociatedModel()?.resolveDeclarationReference(codeDestination, item); + if (declarationReference?.resolvedApiItem) { + const foundItem = declarationReference.resolvedApiItem; + retVal += linkText ?? foundItem.displayName; + } else { + const typeName = codeDestination.memberReferences.map((ref) => ref.memberIdentifier?.identifier).join('.'); + retVal += typeName; + } + } else { + retVal += linkText ?? urlDestination; + } + break; + } + case DocNodeKind.Section: case DocNodeKind.Paragraph: { for (const child of (node as DocParagraph).nodes) {