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>
This commit is contained in:
brynpttrsn 2024-02-03 17:10:28 -05:00 committed by GitHub
parent 9f8d7fe7b4
commit 56943a72f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) {