import Link from 'next/link'; import { Fragment } from 'react'; import { BuiltinDocumentationLinks } from '~/util/builtinDocumentationLinks'; export async function ExcerptNode({ node, version }: { readonly node?: any; readonly version: string }) { const createExcerpt = (excerpts: any) => { const excerpt = Array.isArray(excerpts) ? excerpts : (excerpts.excerpts ?? [excerpts]); return ( {excerpt.map((excerpt: any, idx: number) => { if (excerpt.resolvedItem) { return ( {excerpt.text} ); } if (excerpt.href) { return ( {excerpt.text} ); } if (excerpt.text in BuiltinDocumentationLinks) { const href = BuiltinDocumentationLinks[excerpt.text as keyof typeof BuiltinDocumentationLinks]; return ( {excerpt.text} ); } return {excerpt.text}; })} ); }; return node?.map(createExcerpt) ?? null; }