Skip to content

docs: migrate from MkDocs to Zensical (tutorial) #144

Description

@thomaschristory

Goal

Migrate this repo's documentation from MkDocs + Material for MkDocs to
Zensical — the successor to both, built by the same
team (squidfunk). Zensical reads your existing mkdocs.yml as-is, preserves all
URLs/anchors, keeps Python-Markdown and its extensions, and gives 4–5× faster
incremental builds plus a stricter link/anchor validator.

This is a neutral, self-contained tutorial so it can be executed in a later
session without extra context.

Before you start — compatibility check

Zensical is 0.0.x. It is production-usable if the features you use are
supported
. Verify before committing:

  1. Open mkdocs.yml and list your plugins: and any non-standard theme.features.
  2. Cross-check them against the compatibility matrix:
  3. Vanilla Material setups (stock theme.features, standard markdown_extensions,
    no third-party plugins: beyond built-in search) migrate cleanly. If the
    repo uses plugins like mkdocstrings, gen-files, awesome-pages, etc., the
    module system that replaces them is not yet GA — hold off or plan around it.

Steps

  1. Swap the docs dependencies. In pyproject.toml (or requirements/
    poetry), remove mkdocs and mkdocs-material, add zensical (>=0.0.38).
    Keep pyyaml if present.

  2. Leave mkdocs.yml unchanged. Zensical consumes it natively. Do not
    convert to zensical.toml — upstream advises against it for existing projects.

  3. Update local build/serve commands (justfile / Makefile / scripts / docs):

    • mkdocs servezensical serve (local preview only)
    • mkdocs build --strictzensical build --strict (validates links and anchors)
  4. Update CI. In the docs workflow (e.g. .github/workflows/docs.yml), change
    the build step to uv run zensical build --strict (or pip-equivalent). The
    output directory is still site/, so the Pages upload path: stays the same.
    Keep the mkdocs.yml path trigger — it's still the config file.

  5. Sync and build.

    uv sync --group docs        # or your install command
    uv run zensical build --strict
    

    Expect No issues found, exit 0. Fix any reported broken links/anchors.

  6. Visual spot-check. zensical serve, then eyeball the homepage, one guide,
    and the CLI/API reference. Confirm nav tabs/sections, palette light/dark toggle,
    code-copy, admonitions, tabbed content, and superfences all render.

Good-to-know gotchas

  • zensical serve is preview-only — not for production hosting.
  • Modern theme header: Zensical's modern variant paints the top bar from
    --md-default-bg-color--light (a derived CSS var), not the primary color
    as classic Material does. If you customize colors via extra_css, override that
    variable too or the header keeps the stock near-white/near-black.
  • extra_css + --md-* CSS variables work — custom color tweaks port over.
  • Absolute links are treated as relative; Zensical warns on them.

Acceptance criteria

  • zensical build --strict passes with zero link/anchor issues.
  • Rendered site is visually equivalent to the current Material site.
  • Docs CI is green on the PR.
  • No mkdocs references remain except historical CHANGELOG/lockfiles.

Rollback

mkdocs.yml is untouched, so reverting is just undoing the deps + command + CI
commits — no config or content to restore.

References


Tutorial issue — safe to pick up in a future session. Delete or close if this
repo's docs stay on MkDocs intentionally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions