starlight
Astro Starlight formatter for GraphQL documentation output.
Produces MDX compatible with Astro Starlight using its native Aside and Badge components. Includes lifecycle hooks for generating index files for each category directory.
formatMDXPermalinkβ
const formatMDXPermalink: (id) => MDXString = formatMDXEscapedPermalink;
Defined in: starlight/index.ts:41
Formats a permalink for a section header, using the classic {#id} syntax
escaped to remain valid MDX.
Starlight has no built-in custom header id syntax, so the permalink is inert
unless a remark plugin such as remark-custom-heading-id is configured. Turn
it off with docOptions.sectionHeaderId: false.
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β
Formatted permalink string
mdxDeclarationβ
const mdxDeclaration: MDXString;
Defined in: starlight/index.ts:47
MDX import statement prepended to every generated file to register Starlight components.
mdxExtensionβ
const mdxExtension: ".mdx";
Defined in: starlight/index.ts:44
File extension used for generated pages.
createMDXFormatter()β
function createMDXFormatter(_meta?): Formatter;
Defined in: starlight/index.ts:100
Creates an Astro Starlight formatter.
Parametersβ
_meta?β
Maybe<MetaInfo>
Unused metadata parameter
Returnsβ
Formatter
A complete Formatter implementation for Starlight MDX output
formatMDXAdmonition()β
function formatMDXAdmonition(admonition, _meta): MDXString;
Defined in: starlight/index.ts:69
Formats an admonition using the Starlight <Aside> component.
Maps warning type to caution; all other types use note.
Parametersβ
admonitionβ
AdmonitionType
Admonition data with text, title, and type
_metaβ
Maybe<MetaInfo>
Unused metadata parameter
Returnsβ
MDXString
Formatted Starlight Aside component string
formatMDXBadge()β
function formatMDXBadge(badge): MDXString;
Defined in: starlight/index.ts:57
Formats a badge using the Starlight <Badge> component.
Maps DEPRECATED classname to the caution variant; all others use default.
Parametersβ
badgeβ
Badge
Badge data containing text and optional classname
Returnsβ
MDXString
Formatted Starlight Badge component string
formatMDXLink()β
function formatMDXLink(link): TypeLink;
Defined in: starlight/index.ts:83
Returns the link unchanged β Starlight routes page.mdx to page/ so
links must not include the .mdx extension.
Parametersβ
linkβ
TypeLink
Link data with URL and text
Returnsβ
TypeLink
Unmodified link