From 78036a3b8c3d8837f04035a39f33dc8ea8abcfea Mon Sep 17 00:00:00 2001 From: Ben Cherry Date: Wed, 18 Dec 2024 15:07:52 -0800 Subject: [PATCH] fix --- .../src/documenters/MarkdownDocumenter.ts | 59 +++++++++---------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/tooling/api-documenter/src/documenters/MarkdownDocumenter.ts b/tooling/api-documenter/src/documenters/MarkdownDocumenter.ts index f5b41482c..50fee1036 100644 --- a/tooling/api-documenter/src/documenters/MarkdownDocumenter.ts +++ b/tooling/api-documenter/src/documenters/MarkdownDocumenter.ts @@ -1630,40 +1630,35 @@ export class MarkdownDocumenter { } private _getImportPath(apiItem: ApiDeclaredItem): string { - try { - // Check for custom import path from TSDoc first - if (apiItem instanceof ApiDocumentedItem && apiItem.tsdocComment) { - const packageTag: DocBlock | undefined = apiItem.tsdocComment.customBlocks.find( - (block) => block.blockTag.tagName === '@package', - ); + // Check for custom import path from TSDoc first + if (apiItem instanceof ApiDocumentedItem && apiItem.tsdocComment) { + const packageTag: DocBlock | undefined = apiItem.tsdocComment.customBlocks.find( + (block) => block.blockTag.tagName === '@package', + ); - if (packageTag) { - return packageTag.content.nodes - .map((node) => { - if (node.kind === DocNodeKind.Paragraph) { - return node - .getChildNodes() - .map((child) => { - if (child.kind === DocNodeKind.PlainText) { - return (child as DocPlainText).text; - } - return ''; - }) - .join(''); - } - return ''; - }) - .join('') - .trim(); - } + if (packageTag) { + return packageTag.content.nodes + .map((node) => { + if (node.kind === DocNodeKind.Paragraph) { + return node + .getChildNodes() + .map((child) => { + if (child.kind === DocNodeKind.PlainText) { + return (child as DocPlainText).text; + } + return ''; + }) + .join(''); + } + return ''; + }) + .join('') + .trim(); } - - // Fallback to canonical reference - // @ts-ignore - return apiItem.canonicalReference.source.escapedPath; - } catch (error) { - console.error(error); - return ''; } + + // Fallback to canonical reference + // @ts-ignore + return apiItem.canonicalReference.source.escapedPath; } }