Skip to content

The build process

This section provides an overview about the sequence of operations applied by MkNodes when running the full build process.

Step 1

Load settings

Settings are read from the mknodes entry of the plugins list in mkdocs.yml, [tool.mknodes] in pyproject.toml and the CLI options. The target repository gets cloned in case it is a remote one.

Step 2

Create theme

Initialize the theme object based on the theme configured in mkdocs.yml (default: material).

Step 3

Create context

All available information from following sources is extracted in order to build a project context:

  • metadata.Distribution
  • PyProject File
  • Site config file (mkdocs.yml)
  • Other config files in the repository
  • Git repository info
  • Information from GitHub

Step 4

Build MkNodes tree

The build function (build_fn) is executed with the root MkNav and the theme and the node tree is generated. Without any configuration, the default build function creates a default website (README, API docs, CLI docs, development pages).

Step 5

Collect build artifacts

The BuildCollector walks the node tree and renders every page and nav (Markdown incl. front matter, rendered with jinja2). It aggregates the required resources (CSS / JS / Markdown extensions) and the page templates and converts the template blocks to HTML. The result is an engine-neutral BuildOutput.

Step 6

Write the site input

The ZensicalWriter writes the pages and assets into the docs folder and the template overrides into the theme custom_dir (both tracked in a generated .gitignore, hand-written files are never overwritten) as well as mkdocs.generated.yml, which inherits from mkdocs.yml and adds the nav, the Markdown extensions and the extra CSS / JS.

Step 7

Build with Zensical

zensical build -f mkdocs.generated.yml renders the website.

Page info
Code for this page
mkdocs_mknodes.manual.get_started_section._
@router.route_page("The build process", hide="toc")
def _(page: mk.MkPage):
    page += INTRO
    page += mk.MkTimeline(paths.RESOURCES / "timeline_data.toml")
Resources
Resources(css=[],
          markdown_extensions={},
          plugins=[],
          js=[],
          assets=[Asset('scrollreveal_cab73ad.js'),
                  Asset('timeline_577131c.js'),
                  Asset('timeline_63b66a4.css')],
          packages=[])
Metadata
created:
  source_filename: /home/runner/work/mkdocs-mknodes/mkdocs-mknodes/mkdocs_mknodes/manual/root.py
  source_function: Build.on_root
  source_line_no: 24
hide:
- toc
title: The build process