hugo
Hugo formatter for GraphQL documentation output.
Produces Markdown compatible with Hugo static site generator. Uses GitHub-style alerts (Hugo 0.132+) for admonitions and strips file extensions from internal links to match Hugo's URL routing.
beforeGenerateIndexMetafileHookβ
const beforeGenerateIndexMetafileHook: GenerateIndexMetafileHook;
Defined in: hugo/index.ts:179
Lifecycle hook that generates a Hugo-compatible _index.md section index file.
The file is (re)created on every run with YAML frontmatter:
title: the start-cased category nametype: docs: required by the Hugo Book theme for sidebar renderingbookCollapseSection: true: collapses the section in the Hugo Book theme sidebar by default
Paramβ
Hook event whose data contains dirPath (target directory) and category (section name)
mdxExtensionβ
const mdxExtension: ".md";
Defined in: hugo/index.ts:169
File extension used for generated pages β Hugo uses standard Markdown (.md) files.
createMDXFormatter()β
function createMDXFormatter(_meta?): Formatter;
Defined in: hugo/index.ts:155
Creates a Hugo formatter.
Parametersβ
_meta?β
Maybe<MetaInfo>
Unused metadata parameter
Returnsβ
Formatter
A complete Formatter implementation for Hugo output
formatMDXAdmonition()β
function formatMDXAdmonition(text, _meta): MDXString;
Defined in: hugo/index.ts:77
Formats an admonition using Hugo GitHub-style alert syntax (> [!TYPE]).
Requires Hugo 0.132 or later.
Parametersβ
textβ
AdmonitionType
The admonition body text
_metaβ
Maybe<MetaInfo>
Unused metadata parameter
Returnsβ
MDXString
Formatted blockquote alert string
formatMDXBadge()β
function formatMDXBadge(badge): MDXString;
Defined in: hugo/index.ts:64
Formats a badge as a styled span element.
Parametersβ
badgeβ
Badge
Badge data containing the display text
Returnsβ
MDXString
HTML <span> string with the gqlmd-badge class
formatMDXDetails()β
function formatMDXDetails(dataOpen): MDXString;
Defined in: hugo/index.ts:92
Formats a collapsible block as an HTML <details> element.
Parametersβ
dataOpenβ
CollapsibleOption
Label shown when the section is collapsed (used as <summary> text)
Returnsβ
MDXString
HTML <details>/<summary> block string
formatMDXFrontmatter()β
function formatMDXFrontmatter(props, formatted): MDXString;
Defined in: hugo/index.ts:108
Formats YAML front matter wrapped in --- delimiters, with page title rendered as H1 heading.
Falls back to serializing props via formatFrontMatterObject when formatted is not provided.
The title is extracted from the frontmatter lines and also rendered as a visible # Title heading,
since Hugo does not automatically display the frontmatter title field as page content.
Parametersβ
propsβ
Maybe<FrontMatterOptions>
Front matter options used as fallback when formatted is not provided
formattedβ
Maybe<string[]>
Pre-formatted front matter lines produced by the printer
Returnsβ
MDXString
Formatted front matter block with H1 title heading, or empty string if no data
formatMDXLink()β
function formatMDXLink(text): TypeLink;
Defined in: hugo/index.ts:137
Strips the .md extension from internal links.
Hugo serves pages at extensionless URLs β links with .md would 404 in the built site.
Parametersβ
textβ
TypeLink
Display text for the link
Returnsβ
TypeLink
Link object with the cleaned URL