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:174
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
event
Hook event whose data contains dirPath (target directory) and category (section name)
mdxExtension
const mdxExtension: ".md";
Defined in: hugo/index.ts:164
File extension used for generated pages — Hugo uses standard Markdown (.md) files.
createMDXFormatter()
function createMDXFormatter(_meta?): Formatter;
Defined in: hugo/index.ts:149
Creates a Hugo formatter.
Parameters
_meta?
Maybe<MetaInfo>
Unused metadata parameter
Returns
Formatter
A complete Formatter implementation for Hugo output
formatMDXAdmonition()
function formatMDXAdmonition(admonition, _meta): MDXString;
Defined in: hugo/index.ts:72
Formats an admonition using Hugo GitHub-style alert syntax (> [!TYPE]).
Requires Hugo 0.132 or later.
Parameters
admonition
AdmonitionType
Admonition data with text, optional title, and type (e.g. note, warning, danger) mapped via ALERT_TYPE_MAP
_meta
Maybe<MetaInfo>
Unused metadata parameter
Returns
MDXString
Formatted blockquote alert string
formatMDXBadge()
function formatMDXBadge(badge): MDXString;
Defined in: hugo/index.ts:61
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(option): MDXString;
Defined in: hugo/index.ts:86
Formats a collapsible block as an HTML <details> element.
Parameters
option
CollapsibleOption
Configuration for open/close label text
Returns
MDXString
HTML <details>/<summary> block string
formatMDXFrontmatter()
function formatMDXFrontmatter(props, formatted): MDXString;
Defined in: hugo/index.ts:102
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(link): TypeLink;
Defined in: hugo/index.ts:130
Strips the .md extension from internal links.
Hugo serves pages at extensionless URLs — links with .md would 404 in the built site.
Parameters
link
TypeLink
Link data with text and URL; .md extension is removed from the URL if present
Returns
TypeLink
Link object with the cleaned URL