Skip to content

docs-site/api-doc-link-rendering

Type-link rendering: turns type text and inline link tags into markdown links to generated pages or external references (TypeScript handbook, MDN Web API, JS globals).

Function Description
doesMemberPageExist Whether a member page will be generated for routeSegment on the given type.
findType Resolve a bare type name to a documented TypeInfo. The model map is keyed by a qualified $\{namespace\}#$\{name\} identity, because a package can export the same simple name from different modules. Resolution is best-effort: 1. Prefer a type in currentNamespace (the referencing page’s module). 2. Otherwise, if exactly one type across all modules has that bare name, use it. 3. If the bare name is ambiguous (multiple modules), give up (caller renders plain code).
linkBaseType Link a base type expression for the “Extends:” line. Simple type references (identifier + optional generics) use renderTypeWithLinks so each type argument gets its own link. Complex expressions (object types, intersections, etc.) fall back to typeLink to avoid MDX parsing issues with \{, \}, | etc.
loadExternalTypeMaps Loads the Web API links typedoc-plugin-mdn-links ships, if it is installed. Without it, Web API types render unlinked.
markdownToHtml Convert inline markdown to HTML for use in component props with set:html
memberHref Build the href for a member, pointing to the parent type’s page if inherited
registerMemberPages Populate doesMemberPageExist. Mirrors generateMemberPages’s own filtering exactly (one page per non-inherited property, one per non-inherited method overload key). Must run once before any link is rendered.
registerRouteSegments For every documented type assign BOTH: - a lowercased, numerically-disambiguated FILE segment (so TypeAsserter vs typeAsserter, which both lowercase to typeasserter, become typeasserter / typeasserter-2 on disk and never collide on Windows’ case-insensitive filesystem), and - a case-PRESERVED ROUTE segment (TypeAsserter / typeAsserter) used for the explicit slug: frontmatter and every internal link, so the URLs stay pretty and naturally distinct. The route decouples from the file path via the slug: frontmatter, so no -2 suffix leaks into URLs. Also warns about member-slug collisions within a type. Must run once before any page/link.
renderExampleMdx Render an @example block as MDX. If the example already contains a fenced code block, it is normalized through renderMdxProse (code preserved raw, surrounding prose escaped); otherwise the raw example text is wrapped in a ts code fence so it is emitted literally.
renderMdxProse Render markdown block text (a description, remarks, or module overview) as MDX-safe markdown. Fenced code blocks are re-emitted verbatim (surrounded by blank lines, with a language); prose segments have their inline link tags resolved and their MDX-unsafe characters escaped.
renderTypeWithLinks Render a type string with clickable links for known types
resolveExternalTypeUrl Resolve a type no page of this site documents to the page that does: another documented package’s site, or an entry of the site’s own externalTypeLinks setting.
resolveLinks Resolve @link tags, with or without a | display text part, in description text
resolveTsUtilityUrl Resolves a TypeScript utility type to its handbook entry.
resolveWebApiUrl Resolves a Web API type to its MDN page.
toTypeFileSegment Resolve the lowercased ON-DISK segment for a type (file path + component-import relative path).
toTypeRouteSegment Resolve the case-preserved URL/ROUTE segment for a type (slug frontmatter + internal links).
typeHref Absolute link to a type’s overview page.
typeLink Create an absolute link to a type page