@eryxdoc Module

Docgen build engine — the programmatic API.

Use this library when you want to drive eryxdoc from your own script instead of going through main.luau's CLI.

local eryxdoc = require("./eryxdoc")

eryxdoc.build({
	title = "My Docs",
	modules = "./src/modules",
	articles = "./docs",
	output = "./site",
	prefix = "@mylib",
})

Summary

Functions

eryxdoc.build(cfg: Config){ warnings: { string }, moduleCount: number, articleCount: number }
eryxdoc.exportModulesJson(cfg: ModuleExportConfig, options: { pretty: boolean? }?)string

API Reference

Functions

eryxdoc.build

Runs a full documentation build.

eryxdoc.build(cfg: Config){ warnings: { string }, moduleCount: number, articleCount: number }

Parameters

cfg: Config

The build configuration.

Returns

{ warnings: { string }, moduleCount: number, articleCount: number }

{ warnings: { string }, moduleCount: number, articleCount: number }

eryxdoc.getDefaultTheme

eryxdoc.getDefaultTheme()string

eryxdoc.exportModules

eryxdoc.exportModules(cfg: ModuleExportConfig)any

eryxdoc.exportModulesJson

eryxdoc.exportModulesJson(cfg: ModuleExportConfig, options: { pretty: boolean? }?)string

Types

PageMeta

Metadata for a single page, used for tags and OpenGraph. Returned by metaGenerator or built from defaults.

type PageMeta = { [string]: string? }
description: string?
image: string?
imageAlt: string?
canonicalUrl: string?
type: string?

PageContext

Context passed to the metaGenerator callback so it can decide per-page meta.

type PageContext = { kind: "module" | "article" | "index", name: string?, title: string?, path: string?, summary: string? }
kind: "module" | "article" | "index"
name: string?
title: string?
path: string?
summary: string?

OpenGraphConfig

type OpenGraphConfig = { siteName: string?, image: string?, imageAlt: string?, description: string?, type: string?, locale: string? }
siteName: string?
image: string?
imageAlt: string?
description: string?
type: string?
locale: string?

HeadTag

type HeadTag = { [string]: string }
tag: "link" | "meta"

NavigationLinkConfig

type NavigationLinkConfig = { label: string, href: string, matchPrefix: string?, exact: boolean?, header: boolean?, mobile: boolean? }
label: string
href: string
matchPrefix: string?
exact: boolean?
header: boolean?
mobile: boolean?

SectionLandingConfig

type SectionLandingConfig = { title: string?, description: string?, generate: boolean? }
title: string?
description: string?
generate: boolean?

SectionConfig

type SectionConfig = { id: string, label: string, mount: string?, headerHref: string?, articles: string?, modules: string?, prefix: string?, landing: SectionLandingConfig?, children: { SectionConfig }? }
id: string
label: string
mount: string?
headerHref: string?
articles: string?
modules: string?
prefix: string?
children: { SectionConfig }?

NavigationHeaderConfig

type NavigationHeaderConfig = { mode: "auto" | "tabs" | "none"?, mobile: { includeSectionLinks: boolean? }? }
mode: "auto" | "tabs" | "none"?
mobile: { includeSectionLinks: boolean? }?

NavigationConfig

type NavigationConfig = { header: NavigationHeaderConfig?, splitApiReference: boolean?, headerLinks: { NavigationLinkConfig }? }
splitApiReference: boolean?

Legacy options. Prefer sections for new configs.

headerLinks: { NavigationLinkConfig }?

Config

type Config = { output: string, modules: string?, articles: string?, prefix: string?, sections: { SectionConfig }?, noModules: boolean?, title: string?, siteRoot: string?, baseUrl: string?, exportMode: ("flat" | "directory")?, theme: string?, static: string?, staticMount: string?, favicon: string?, head: { HeadTag }?, extraHead: string?, extraScripts: string?, announcement: string?, openGraph: OpenGraphConfig?, articleMetaGenerator: (((context: PageContext) → PageMeta))?, apiMetaGenerator: (((context: PageContext) → PageMeta))?, customFilters: { [string]: ((any, { [string]: any }) → any) }?, customGlobals: { [string]: any }?, navigation: NavigationConfig?, version: { name: string, label: string?, isDefault: boolean? }?, redirects: { { from: string, to: string } }?, hooks: { onBuildStart: (((cfg: Config) → ()))?, onPageRender: ( ( html: string, page: { kind: "article" | "module" | "index" | "404", name: string?, path: string } )string )?, onBuildComplete: ( ( result: { moduleCount: number, articleCount: number, outputDir: string } )() )? }?, clean: boolean?, showLastUpdated: boolean? }
output: string

Required

modules: string?

Content sources

articles: string?
prefix: string?
sections: { SectionConfig }?
noModules: boolean?
title: string?

Site settings

siteRoot: string?
baseUrl: string?
exportMode: ("flat" | "directory")?
theme: string?

Theming

static: string?
staticMount: string?
favicon: string?

HTML injections

head: { HeadTag }?
extraHead: string?
extraScripts: string?
announcement: string?
openGraph: OpenGraphConfig?

OpenGraph / SEO

articleMetaGenerator: (((context: PageContext) → PageMeta))?

Optional callbacks that return per-page meta for each page type. Overrides global openGraph defaults for that page. Return nil fields to fall back to the global defaults.

apiMetaGenerator: (((context: PageContext) → PageMeta))?
customFilters: { [string]: ((any, { [string]: any }) → any) }?

Template customisation

customGlobals: { [string]: any }?
navigation: NavigationConfig?
version: { name: string, label: string?, isDefault: boolean? }?

Versioning When set, the build output goes into output/{version.name}/ and a versions.json manifest is written/updated at the output root. The version picker in the header reads this manifest.

redirects: { { from: string, to: string } }?

Redirects Each entry generates an HTML redirect stub at the "from" path. Useful when pages are moved to keep old URLs working.

hooks: { onBuildStart: (((cfg: Config) → ()))?, onPageRender: (((html: string, page: { kind: "article" | "module" | "index" | "404", name: string?, path: string }) → string))?, onBuildComplete: (((result: { moduleCount: number, articleCount: number, outputDir: string }) → ()))? }?

Build hooks Callbacks invoked at key points during the build. All are optional.

clean: boolean?

Build options

showLastUpdated: boolean?

ModuleExportConfig

type ModuleExportConfig = { modules: string, prefix: string? }
modules: string
prefix: string?