Pudu programming language
Menu
Package

@chrismichaelps / pudu-lang-docgen

Documentation publishing for Pudu: articles, API references, navigation, search, and static websites

0.1.0Apache-2.01

InstallClose

configuration.md

Markdown158 lines8.4 KB

GitHub ↗

Configuration reference


uid: guides.configuration description: Every docgen.json setting with its type, default, and effect.


A project is configured by docgen.json in the project folder. The same settings can be written as YAML in a .yml or .yaml file; pass that file's path to the command line instead of a folder.

The file has three top-level sections. Any key that is not listed on this page is rejected with DG501, which names the exact location of the key, such as build.sitemap.priority.

{
  "metadata": [ ],
  "build": { },
  "pdf": { }
}

All paths are relative to the configuration file's folder and may not leave it, except API source folders, which may start with ../.

File mappings

build.content, build.resource, build.overwrite, and metadata[].src select files with mappings. A mapping is an object, and a key may hold one mapping or a list of them. A plain glob, or a list of plain globs, is shorthand for one mapping with only files.

KeyTypeDefaultDescription
filesglob or list of globsrequiredFiles to select, matched against their path inside src.
excludeglob or list of globsnoneFiles to leave out.
srcfolderproject folderThe folder the globs apply to. Its name is not part of the output path.
destfolderoutput rootThe folder the selected files are published under.
grouptextnoneThe name of an entry in build.groups whose dest and metadata apply to these files.

The first mapping that selects a file wins.

API metadata settings

metadata is a list of sources, each producing an API reference.

KeyTypeDefaultDescription
srcmappingsrequiredThe Pudu source files to document. src folders may lie above the project with ../.
destfolderapiThe folder that receives the reference pages and their toc.yml.
includePrivateMembersflagfalseAlso document declarations that are not exported.
filterobject or pathnoneinclude and exclude lists of uid globs, or the path of a YAML file of apiRules.
sourceUrltextnoneA link pattern for source lines; {path} and {line} are filled in.
sourceLinkExcludelist of globsnoneSource paths that get no source link.
outputFormatjson, markdown, apiPagejsonThe format the metadata command writes.
namespaceLayoutflattened, nestedflattenedWhether modules nest by their dotted names in navigation.
memberLayoutsamePage, separatePagessamePageWhether functions and constants get pages of their own.
categoryLayoutflattened, nested, noneflattenedHow a module's navigation entries are grouped by kind.
enumSortOrderdeclaringOrder, alphabeticdeclaringOrderThe order of union variants.
shouldSkipMarkupflagfalseShow doc comments as plain text instead of Markdown.

Build settings

Inputs

KeyTypeDefaultDescription
contentmappingsnoneArticles, tables of contents, OpenAPI descriptions, API pages, and catalogs.
resourcemappingsnoneFiles copied to the output unchanged.
overwritemappingsnoneOverwrite files that amend pages by uid.
xreflist of paths or addressesnoneCross-reference maps of other sites.
xrefServicelist of addresses holding {uid}noneReference services asked for identities nothing else resolves.
groupsobjectnoneNamed sets of dest and metadata that mappings refer to with group.

Output

KeyTypeDefaultDescription
outputfolder_siteWhere the site is written. dest is accepted as another name for it. It may not be the project folder itself.
dryRunflagfalseValidate and plan the site without writing anything.
exportRawModelflagfalseWrite each page's data model as <page>.raw.json.
rawModelOutputFolderfolderthe output folderWhere raw models are written.
exportViewModelflagfalseWrite each page's template view as <page>.view.json.
viewModelOutputFolderfolderthe output folderWhere view models are written.

Metadata

KeyTypeDefaultDescription
globalMetadataobjectnoneMetadata for every page. See page metadata.
globalMetadataFileslist of pathsnoneJSON or YAML files merged into global metadata, later files winning.
fileMetadataobjectnoneMetadata by glob: each key maps glob patterns to the value files matching them receive.
fileMetadataFileslist of pathsnoneJSON or YAML files of further fileMetadata rules.
"fileMetadata": {
  "_disableContribution": { "docs/generated/**": true },
  "keywords": { "docs/guides/**": ["guide"] }
}

fileMetadata globs match the file's path in the project, such as docs/guides/markdown.md.

Appearance

KeyTypeDefaultDescription
templatelist of names or folders["default"]The built-in template followed by template folders, later ones overriding earlier ones. Also accepts the built-in extensions rest.tagpage and rest.operationpage.
themelist of foldersnoneTemplate folders applied after every template entry.
markdownEngineProperties.alertsobjectnoneExtra alert kinds mapped to the CSS classes they use, such as { "SECURITY": "alert alert-caution" }.
markdownEngineProperties.plantUml.remoteUrladdresshttps://www.plantuml.com/plantumlThe PlantUML server.
markdownEngineProperties.plantUml.outputFormatsvg, png, txtsvgThe diagram format requested.
markdownEngineProperties.plantUml.renderingModeremote, localremotelocal draws diagrams during the build with a local PlantUML.
markdownEngineProperties.plantUml.localPlantUmlPathpathplantuml.jarThe PlantUML archive used for local rendering.
markdownEngineProperties.plantUml.javaPathpathjavaThe Java runtime used for local rendering.

Search engines

KeyTypeDefaultDescription
sitemap.baseUrladdressrequiredThe absolute http or https address the site is published at.
sitemap.changefreqalways, hourly, daily, weekly, monthly, yearly, nevernoneThe change frequency of every page.
sitemap.prioritynumber from 0.0 to 1.0noneThe priority of every page.
sitemap.fileOptionsobjectnonebaseUrl, changefreq, and priority for pages matching each glob; the last matching glob wins.

The sitemap is written only when sitemap is present. See Search and SEO.

Repository

KeyTypeDefaultDescription
disableGitFeaturesflagfalseSkip last-modified dates and edit links taken from git.
gitContribute.repoaddressdetectedThe repository behind Edit this page links.
gitContribute.branchtextmainThe branch edit links point at.
gitContribute.pathfoldernoneThe project folder's path inside the repository.

Without gitContribute.repo, the repository is read from DOCGEN_SOURCE_REPOSITORY_URL, then from the variables of common build services, then from the local clone's origin remote. The branch is read the same way, starting with DOCGEN_SOURCE_BRANCH_NAME. Edit links follow the conventions of GitHub, GitLab, Bitbucket, and Azure DevOps.

Diagnostics

KeyTypeDefaultDescription
warningsAsErrorsflagfalseFail the build on any warning.
rulesobjectnoneDiagnostic codes mapped to error, warning, info, or off.
"rules": { "DG211": "error", "DG124": "off" }

See the diagnostics reference for every code.

PDF settings

KeyTypeDefaultDescription
pdf.rendererlist of textdetectedThe command that prints a document, with {input}, {output}, {url}, {header}, and {footer} filled in.

See PDF output.

Complete example

This site's configuration:

[!code-json[](../../docgen.json "website/docgen.json")]