Skip to main content

mdx

Generic MDX formatter for GraphQL documentation output.

Produces framework-neutral .mdx pages: plain Markdown and JSX-safe HTML, with no framework components and no import declarations. Header permalinks are escaped (\{#id\}) so that they remain valid MDX. YAML front matter is kept, and internal links are rewritten to page-relative paths.

afterRenderTypeEntitiesHook​

const afterRenderTypeEntitiesHook: RenderTypeEntitiesHook;

Defined in: mdx/index.ts:104

Rewrites absolute generated doc links to page-relative .mdx paths after each page is rendered.


const formatMDXPermalink: (id) => MDXString = formatMDXEscapedPermalink;

Defined in: mdx/index.ts:97

Formats a header permalink with escaped braces (\{#id\}), valid in MDX.

Formats a permalink for a section header using the classic {#id} syntax, escaped so that it stays valid MDX.

MDX parses an unescaped { as the start of an expression, and {#id} is not a valid one, so presets generating .mdx pages must use this variant.

Parameters​

id​

string

The ID of the section header

Returns​

MDXString

Formatted permalink string

Example​

formatMDXEscapedPermalink("my-id"); // \{#my-id\}

Param​

id

The ID of the section header

Returns​

Escaped permalink string


mdxExtension​

const mdxExtension: ".mdx" = ".mdx";

Defined in: mdx/index.ts:38

Generic MDX pages use the .mdx extension.


createMDXFormatter()​

function createMDXFormatter(_meta?): Formatter;

Defined in: mdx/index.ts:115

Creates a generic MDX formatter.

Parameters​

_meta?​

Maybe<MetaInfo>

Unused metadata parameter

Returns​

Formatter

A complete Formatter implementation for generic MDX output


formatMDXAdmonition()​

function formatMDXAdmonition(admonition, _meta): MDXString;

Defined in: mdx/index.ts:46

Formats an admonition as a Markdown blockquote with a bold type/title label.

Parameters​

admonition​

AdmonitionType

Admonition data with text, title, and type

_meta​

Maybe<MetaInfo>

Unused metadata parameter

Returns​

MDXString

Formatted admonition string


formatMDXDetails()​

function formatMDXDetails(option): MDXString;

Defined in: mdx/index.ts:60

Formats a collapsible block as an HTML <details> element. The output is split on \r by the printer into [openSection, closeSection].

Parameters​

option​

CollapsibleOption

Configuration for open/close label text

Returns​

MDXString

Formatted collapsible string


function formatMDXLink(link): TypeLink;

Defined in: mdx/index.ts:72

Rewrites extensionless absolute links so they point to .mdx pages.

Parameters​

TypeLink

Link data with URL and text

Returns​

TypeLink

The link with .mdx appended to extensionless absolute paths