Skip to main content

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 name
  • type: docs: required by the Hugo Book theme for sidebar rendering
  • bookCollapseSection: 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


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