fix(website): links to builtin documentation not showing in summary (#10267)

This commit is contained in:
Qjuh
2024-05-10 22:38:43 +02:00
committed by GitHub
parent e673b3c129
commit 5498e18bf4
2 changed files with 17 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import Link from 'next/link';
import { BuiltinDocumentationLinks } from '~/util/builtinDocumentationLinks';
import { OverlayScrollbarsComponent } from './OverlayScrollbars';
import { SyntaxHighlighter } from './SyntaxHighlighter';
@@ -34,6 +35,21 @@ export async function DocNode({ node, version }: { readonly node?: any; readonly
);
}
if (node.text in BuiltinDocumentationLinks) {
const href = BuiltinDocumentationLinks[node.text as keyof typeof BuiltinDocumentationLinks];
return (
<a
key={`${node.text}-${idx}`}
className="text-blurple hover:text-blurple-500 dark:hover:text-blurple-300"
href={href}
rel="external noreferrer noopener"
target="_blank"
>
{node.text}
</a>
);
}
return <span key={`${node.text}-${idx}`}>{node.text}</span>;
}