docusaurus
Docusaurus MDX formatter for GraphQL documentation output.
Produces MDX markup compatible with Docusaurus v2 and v3, using Badge, Bullet, SpecifiedBy components and native admonition syntax.
mdxDeclarationβ
const mdxDeclaration: MDXString;
Defined in: docusaurus/index.ts:43
MDX component definitions prepended to every generated file.
createMDXFormatter()β
function createMDXFormatter(meta?): Formatter;
Defined in: docusaurus/index.ts:201
Creates a Docusaurus formatter.
Captures meta in closure so formatMDXAdmonition can detect the Docusaurus version.
Parametersβ
meta?β
Maybe<MetaInfo>
Optional metadata used to detect Docusaurus version
Returnsβ
Formatter
A complete Formatter implementation for Docusaurus MDX output
formatMDXAdmonition()β
function formatMDXAdmonition(admonition, meta): MDXString;
Defined in: docusaurus/index.ts:72
Formats an admonition using Docusaurus native :::type callout syntax.
Detects Docusaurus v2 (via meta) and uses :::caution instead of :::warning.
Parametersβ
admonitionβ
AdmonitionType
Admonition data with text, title, and type
metaβ
Maybe<MetaInfo>
Optional metadata used to detect Docusaurus version
Returnsβ
MDXString
Formatted admonition string
formatMDXBadge()β
function formatMDXBadge(badge): MDXString;
Defined in: docusaurus/index.ts:59
Formats a badge using the inline <Badge> component defined in mdxDeclaration.
Appends a CSS class derived from classname (e.g. badge--deprecated).
Parametersβ
badgeβ
Badge
Badge data containing text and optional classname
Returnsβ
MDXString
Formatted Badge component string
formatMDXBullet()β
function formatMDXBullet(text?): MDXString;
Defined in: docusaurus/index.ts:90
Formats a bullet point using the inline <Bullet/> component defined in mdxDeclaration.
Parametersβ
text?β
string = ""
Optional text to append after the bullet
Returnsβ
MDXString
Formatted Bullet component string
formatMDXDetails()β
function formatMDXDetails(option): MDXString;
Defined in: docusaurus/index.ts:101
Formats a collapsible block as an HTML <details> element with
toggle labels that swap via the hidden attribute.
Text is escaped so curly braces and angle brackets don't break MDX.
Parametersβ
optionβ
CollapsibleOption
Configuration for open/close label text
Returnsβ
MDXString
Formatted details element string
formatMDXFrontmatter()β
function formatMDXFrontmatter(_props, formatted): MDXString;
Defined in: docusaurus/index.ts:153
Formats YAML front matter wrapped in --- delimiters.
Parametersβ
_propsβ
Maybe<FrontMatterOptions>
Front matter options (unused)
formattedβ
Maybe<string[]>
Pre-formatted front matter lines
Returnsβ
MDXString
Formatted front matter block, or empty string if no lines provided
formatMDXLink()β
function formatMDXLink(link): TypeLink;
Defined in: docusaurus/index.ts:140
Appends .mdx to internal link URLs.
Parametersβ
linkβ
TypeLink
Link data with URL and text
Returnsβ
TypeLink
Link with .mdx extension appended to the URL
formatMDXNameEntity()β
function formatMDXNameEntity(name, parentType?): MDXString;
Defined in: docusaurus/index.ts:127
Formats a named entity as an inline <code> element with the parent type
in normal weight and the entity name in bold.
Text is escaped so curly braces don't break MDX.
Parametersβ
nameβ
string
Entity name
parentType?β
Maybe<string>
Optional parent type name for qualified references
Returnsβ
MDXString
Formatted JSX code element string
formatMDXPermalink()β
function formatMDXPermalink(id, meta?): MDXString;
Defined in: docusaurus/index.ts:179
Formats a permalink for a section header.
Docusaurus 3.10 introduced a heading id syntax based on a native MDX comment, and deprecated the classic one. The braces of the comment must NOT be escaped: the heading id is extracted from a real MDX expression node, so an escaped token would be rendered as text. Older versions only support the classic syntax, whose braces must be escaped to remain valid MDX.
Parametersβ
idβ
string
The ID of the section header
meta?β
Maybe<MetaInfo>
Optional metadata used to detect the Docusaurus version
Returnsβ
MDXString
Formatted permalink string
Seeβ
https://docusaurus.io/blog/releases/3.10#strict-heading-ids
formatMDXSpecifiedByLink()β
function formatMDXSpecifiedByLink(url): MDXString;
Defined in: docusaurus/index.ts:115
Formats a "specified by" link using the inline <SpecifiedBy> component.
Parametersβ
urlβ
string
URL to the specification
Returnsβ
MDXString
Formatted SpecifiedBy component string