Skip to content

Migrate the documentation tooling to Zensical - #288

Open
kattni wants to merge 6 commits into
beeware:mainfrom
kattni:tooling/zensical-migration
Open

kattni wants to merge 6 commits into
beeware:mainfrom
kattni:tooling/zensical-migration

Conversation

@kattni

@kattni kattni commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Migrates the BeeWare documentation tooling from MkDocs (with Material for MkDocs) to Zensical, and moves the configuration to Zensical's native file formats.

What changes

  • Build and live serve run zensical build / zensical serve (Zensical 0.1.0, pinned exactly, as it's pre-1.0). The MkDocs build path is removed.
  • Configuration moves from docs/config.yml + docs/mkdocs.<lang>.yml (YAML with INHERIT and !ENV) to docs/zensical.toml + per-language docs/zensical.<lang>.toml:
    • docs-tools merges the two with the same rule INHERIT used: tables merge, lists and values replace.
    • A language file that sets anything other than the per-language settings produces a warning.
    • site_url is filled in from Read the Docs when it isn't set.
  • Navigation moves from literate-nav (docs/en/SUMMARY.md) to the native nav setting.
  • Theme overrides are preserved, with fixes for Zensical:
    • The language selector links, header search, the homepage <title>, and the TOC text size.
    • The classic theme variant and macros on_error_fail are set by default at build time.
  • Translated builds:
    • Each translation gets its own site_url, including the language directory. This fixes canonical links, sitemaps and 404 pages that pointed at the English site. That problem predates this PR.
    • Images and other resources are copied file by file, because Zensical doesn't follow symlinked directories.
    • mkdocstrings ::: blocks with an options: block are kept out of the translation catalogs and restored after po2md, which joins them onto one line and breaks the build. The docs-tools test page now exercises this.
  • Dependencies: mkdocs-material, the macros plugin fork, mkdocs-literate-nav and mkdocs-rss-plugin are dropped. mkdocs stays, with a comment explaining why: mkdocstrings imports it when it runs; it's not used to build anything. Dropping mkdocs-rss-plugin was verified on the website: its feeds are byte-identical, apart from build timestamps, without the plugin installed.

Translations

The translation workflow (md2po/po2md, Weblate, DeepL) is unchanged.

  • Navigation titles now have their own context (msgctxt "navigation"). This keeps them separate from page headings with the same text, which often had a different translation.
    • All 760 navigation title translations in docs-tools match what main displays.
    • In other repositories, untranslated navigation entries are filled in from their previous translations on the next translation run.
  • Changed strings: existing translations were ported to the new wording where possible:
    • 197 translations carried over exactly, 24 of them human-reviewed.
    • 25 kept and marked for review, 9 of them human-reviewed.
    • Strings whose content was rewritten (for example, YAML examples that are now TOML) are left for machine translation, so they don't show outdated instructions.
  • Check: running the translation pipeline twice leaves all 19,456 entries unchanged.

Before merging: this PR edits every translations.po file, so lock Weblate and pull its pending changes first, as the translate.yml workflow does.

Notes for reviewers

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

Assisted-by: Claude Code (Claude Opus 5.5)

- Build and live-serve run Zensical 0.1.0 (pinned) instead of MkDocs.
- Config moves to Zensical-native files: docs/zensical.toml plus
  per-language docs/zensical.<lang>.toml overrides, merged by docs-tools
  with the MkDocs INHERIT rule. Unexpected keys in a language file warn.
- Navigation moves from literate-nav (SUMMARY.md) to native `nav`;
  existing nav-title translations are migrated in the PO files.
- Add convert_mkdocs_config to convert downstream repos, with an
  equivalence check against the old YAML configuration.
- Build-time defaults: classic theme variant, macros on_error_fail.
- Theme fixes for Zensical: language selector links, header search,
  homepage title, TOC text, mkdocstrings locale.
- Translated builds copy non-Markdown resources file by file.
- Drop the MkDocs fallback and MkDocs-only dependencies.
…ration.

- Give navigation titles their own translation context ("navigation"),
  so they keep the translations they had in SUMMARY.md instead of
  sharing one with page headings of the same text. Untranslated
  navigation entries are seeded from previous translations, so other
  repos keep theirs on their next translation run.
- Re-migrate docs-tools' nav-title translations from main: all 760 now
  match what main displayed.
- Port existing translations of the strings that changed in this
  migration (style guide, translation guide, test bed), applying the
  same substitutions; human translations whose meaning changed are kept
  and marked for review.
- Keep mkdocstrings API directives out of the translation catalogs, and
  restore them after po2md, which mangles their options blocks.
- Give translated builds their own site_url (with the language
  directory), fixing their canonical links, sitemaps and 404 pages.
- Refer to Zensical in the style guide.
- Drop mkdocs-rss-plugin; Zensical handles RSS natively.
The converter is only needed once per repository, and relies on private
Zensical APIs, so it isn't part of docs-tools. Repositories are converted
from a separate branch before this is merged.
The nav-item override compared navigation items with the page object,
which never matches under Zensical, so the current page's table of
contents wasn't shown under its link in the sidebar, and the active link
was only highlighted by JavaScript. Use .active, as Zensical's own
template does, and import the language helpers into the TOC partial,
which is now rendered there.
…into tooling/zensical-migration

# Conflicts:
#	docs/locales/ar/translations.po
#	docs/locales/cs/translations.po
#	docs/locales/da/translations.po
#	docs/locales/de/translations.po
#	docs/locales/es/translations.po
#	docs/locales/fa/translations.po
#	docs/locales/fr/translations.po
#	docs/locales/it/translations.po
#	docs/locales/ja/translations.po
#	docs/locales/ko/translations.po
#	docs/locales/pl/translations.po
#	docs/locales/pt/translations.po
#	docs/locales/ru/translations.po
#	docs/locales/ta/translations.po
#	docs/locales/tr/translations.po
#	docs/locales/uk/translations.po
#	docs/locales/vi/translations.po
#	docs/locales/zh_CN/translations.po
#	docs/locales/zh_TW/translations.po
#	pyproject.toml
#	src/beeware_docs_tools/shared_content/locales/ar/translations.po
#	src/beeware_docs_tools/shared_content/locales/cs/translations.po
#	src/beeware_docs_tools/shared_content/locales/da/translations.po
#	src/beeware_docs_tools/shared_content/locales/de/translations.po
#	src/beeware_docs_tools/shared_content/locales/es/translations.po
#	src/beeware_docs_tools/shared_content/locales/fa/translations.po
#	src/beeware_docs_tools/shared_content/locales/fr/translations.po
#	src/beeware_docs_tools/shared_content/locales/it/translations.po
#	src/beeware_docs_tools/shared_content/locales/ja/translations.po
#	src/beeware_docs_tools/shared_content/locales/ko/translations.po
#	src/beeware_docs_tools/shared_content/locales/pl/translations.po
#	src/beeware_docs_tools/shared_content/locales/pt/translations.po
#	src/beeware_docs_tools/shared_content/locales/ru/translations.po
#	src/beeware_docs_tools/shared_content/locales/ta/translations.po
#	src/beeware_docs_tools/shared_content/locales/tr/translations.po
#	src/beeware_docs_tools/shared_content/locales/uk/translations.po
#	src/beeware_docs_tools/shared_content/locales/vi/translations.po
#	src/beeware_docs_tools/shared_content/locales/zh_CN/translations.po
#	src/beeware_docs_tools/shared_content/locales/zh_TW/translations.po
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant