Skip to content

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.

Import:

import { renderExampleMdx } from '@mnaoumov/typescript-dev-toolkit/docs-site/api-doc-link-rendering';

Signature:

function renderExampleMdx(example: string, allTypes: Map<string, TypeInfo>, selfNamespace: string | undefined): string

Parameters:

Parameter Type Description
example string The @example text.
allTypes Map<string, TypeInfo> Every documented type, keyed by $\{namespace\}#$\{name\}.
selfNamespace string | undefined The namespace of the page being rendered, preferred when a name is ambiguous.

Returns: string — The MDX.