Skip to content

Replace MkDocs with Zensical for the documentation site - #544

Merged
giswqs merged 2 commits into
mainfrom
zensical
Jul 6, 2026
Merged

Replace MkDocs with Zensical for the documentation site#544
giswqs merged 2 commits into
mainfrom
zensical

Conversation

@giswqs

@giswqs giswqs commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

Migrates the documentation site from MkDocs + Material to Zensical, the successor static site generator from the Material for MkDocs team.

  • zensical.toml replaces mkdocs.yml, porting the full nav (Examples, Workshops, API Reference), theme (light/dark palettes following system preference, GitHub repo icon), markdown extensions, and mkdocstrings configuration.
  • Notebook handling: Zensical does not yet support mkdocs-jupyter, so scripts/convert_notebooks.py converts all notebooks under docs/examples/ and docs/workshops/ to Markdown at build time with nbconvert. Each generated page starts with a badge linking to the original notebook on GitHub (replacing the old theme-override download button). The generated .md files are gitignored.
  • CI: docs.yml now builds with zensical build and deploys site/ to gh-pages via peaceiris/actions-gh-pages (replacing mkdocs gh-deploy). docs-build.yml keeps the Netlify PR preview, just swapping in the conversion step and zensical build.
  • Dependencies: requirements_docs.txt drops all mkdocs-* packages in favor of zensical + mkdocstrings-python + nbconvert.

Testing

  • zensical build --clean --strict passes locally with no issues (5.4s full build).
  • Verified rendered output: notebook example pages render as HTML with download badges, mkdocstrings API pages render all doc objects, nav and external links intact, CNAME copied into site/ for the custom domain.
  • pre-commit run --all-files passes.

Notes

  • The git-revision-date plugin has no Zensical equivalent yet, so the page-revision dates are dropped for now (on Zensical's roadmap).
  • Zensical is pre-1.0 (0.0.47); config compatibility is tracked at https://zensical.org/compatibility/plugins/

Summary by CodeRabbit

  • New Features

    • Documentation site now publishes via a new build-and-deploy workflow that uses converted notebook content.
    • Notebook pages can include a direct “Download notebook” link.
  • Changes

    • Updated documentation configuration to the new site generator setup.
    • Removed the previous documentation (MkDocs) configuration and template override.
  • Chores

    • Updated ignore rules to exclude generated notebook Markdown artifacts from version control.

- Port mkdocs.yml to zensical.toml (nav, theme, extensions, mkdocstrings)
- Add scripts/convert_notebooks.py to convert example/workshop notebooks
  to Markdown at build time (Zensical does not yet support mkdocs-jupyter);
  each page links back to the original notebook
- Update docs workflows: build with zensical, deploy site/ to gh-pages
  via peaceiris/actions-gh-pages; keep Netlify PR previews
- Swap mkdocs dependencies for zensical in requirements_docs.txt
- Remove docs/overrides (mkdocs-jupyter download button, now obsolete)
Copilot AI review requested due to automatic review settings July 6, 2026 21:47
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR migrates the docs pipeline from MkDocs to Zensical, adds notebook-to-Markdown conversion for docs notebooks, and updates the build, deploy, dependency, and ignore rules around the new generated site output.

Changes

MkDocs to Zensical Migration

Layer / File(s) Summary
Notebook-to-Markdown conversion script
scripts/convert_notebooks.py
Adds a script that converts notebooks in docs/examples and docs/workshops into sibling Markdown files with a download badge and per-file failure handling.
Zensical site configuration
zensical.toml, mkdocs.yml, docs/overrides/main.html
Adds Zensical site metadata, navigation, theme, mkdocstrings, and Markdown settings while removing the old MkDocs config and override template.
CI workflows, dependencies, and ignores
.github/workflows/docs-build.yml, .github/workflows/docs.yml, requirements_docs.txt, .gitignore
Updates docs workflows to convert notebooks, build with Zensical, and deploy via GitHub Pages; swaps documentation requirements to Zensical; ignores generated notebook Markdown files.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workflow as docs.yml / docs-build.yml
  participant Script as scripts/convert_notebooks.py
  participant Zensical as zensical build
  participant Pages as GitHub Pages

  Workflow->>Script: run notebook conversion
  Script-->>Workflow: generated .md files
  Workflow->>Zensical: build site from converted docs
  Zensical-->>Workflow: ./site output
  Workflow->>Pages: deploy ./site with actions-gh-pages
Loading

Poem

A rabbit hopped through docs so bright,
Swapped MkDocs for Zensical tonight. 🐇
Notebooks bloom to Markdown neat,
Then build and deploy with steady feet,
The site now springs with fresh new light.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: migrating the documentation site from MkDocs to Zensical.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch zensical

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the documentation site from MkDocs + Material to Zensical, including notebook-to-Markdown conversion at build time and updates to CI workflows for GitHub Pages and Netlify previews.

Changes:

  • Add zensical.toml configuration replacing mkdocs.yml (nav/theme/markdown extensions + mkdocstrings handler config).
  • Add scripts/convert_notebooks.py and ignore generated notebook Markdown outputs.
  • Update documentation workflows to run notebook conversion + zensical build, and adjust docs dependencies accordingly.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
zensical.toml New Zensical site configuration replacing MkDocs config (nav/theme/extensions/mkdocstrings).
scripts/convert_notebooks.py Converts docs/examples and docs/workshops notebooks to Markdown for Zensical builds.
requirements_docs.txt Removes MkDocs packages and adds Zensical-related doc build dependencies.
mkdocs.yml Removes legacy MkDocs configuration.
docs/overrides/main.html Removes MkDocs theme override previously used for notebook download UI.
.gitignore Ignores generated .md files produced from notebooks during docs builds.
.github/workflows/docs.yml Switches GitHub Pages deployment to Zensical + notebook conversion + gh-pages action.
.github/workflows/docs-build.yml Switches Netlify PR preview build from MkDocs to Zensical + notebook conversion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/docs.yml Outdated
Comment thread .github/workflows/docs-build.yml Outdated
Comment thread .github/workflows/docs.yml Outdated
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 6, 2026 21:50 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
requirements_docs.txt (1)

10-21: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

nbconvert/nbformat not present in this file's diff.

docs-build.yml installs docs dependencies solely via this file, and scripts/convert_notebooks.py requires nbformat and nbconvert. If these packages aren't already elsewhere in this file (outside the shown diff), the docs-build.yml conversion step will fail at runtime. As per PR objectives, "The docs requirements are updated to remove mkdocs-* packages and use Zensical, mkdocstrings-python, and nbconvert instead," so nbconvert should be explicitly added here — please confirm it's present.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@requirements_docs.txt` around lines 10 - 21, The docs requirements list is
missing an explicit dependency needed by the notebook conversion step. Verify
that requirements_docs.txt includes nbconvert alongside nbformat, since
docs-build.yml relies on this file and scripts/convert_notebooks.py imports
both. If nbconvert is not already present elsewhere in the file, add it in the
docs dependency list near the other documentation packages so the docs build can
run successfully.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/docs.yml:
- Around line 6-7: The workflow currently grants workflow-level contents: write,
which is broader than needed and lacks an explanation. Move the write permission
to the deploy job in the docs workflow so only that job can push to gh-pages,
and add a short comment near the permission explaining why deploy needs write
access. Use the existing deploy job and permissions section to locate the
change.
- Line 26: The deploy step using peaceiris/actions-gh-pages@v4 should be pinned
to an immutable commit SHA instead of a mutable tag. Update the action reference
in the docs publishing workflow so the gh-pages deployment still works with
contents: write and gh-pages, but is locked to a specific revision of
peaceiris/actions-gh-pages for supply-chain safety.

In `@scripts/convert_notebooks.py`:
- Around line 50-53: The notebook conversion loop in
convert_notebook/NOTEBOOK_DIRS currently aborts the whole script on the first
parse or export failure. Wrap each per-notebook conversion in the main loop with
exception handling, log which nb_path failed and which ones succeeded before it,
and continue processing the remaining notebooks. At the end of the script,
return a non-zero exit status if any notebook conversion failed so CI still
fails cleanly.

---

Outside diff comments:
In `@requirements_docs.txt`:
- Around line 10-21: The docs requirements list is missing an explicit
dependency needed by the notebook conversion step. Verify that
requirements_docs.txt includes nbconvert alongside nbformat, since
docs-build.yml relies on this file and scripts/convert_notebooks.py imports
both. If nbconvert is not already present elsewhere in the file, add it in the
docs dependency list near the other documentation packages so the docs build can
run successfully.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8331f7dd-9eb6-451b-8087-74cb6798d247

📥 Commits

Reviewing files that changed from the base of the PR and between a6919f5 and e23a8f8.

📒 Files selected for processing (8)
  • .github/workflows/docs-build.yml
  • .github/workflows/docs.yml
  • .gitignore
  • docs/overrides/main.html
  • mkdocs.yml
  • requirements_docs.txt
  • scripts/convert_notebooks.py
  • zensical.toml
💤 Files with no reviewable changes (2)
  • docs/overrides/main.html
  • mkdocs.yml

Comment thread .github/workflows/docs.yml Outdated
Comment thread .github/workflows/docs.yml Outdated
Comment thread scripts/convert_notebooks.py Outdated
- Install requirements_docs.txt in the docs deploy workflow instead of an
  ad-hoc package list (Copilot)
- Run zensical build --clean --strict in both docs workflows to match the
  validated command and fail fast on warnings (Copilot)
- Scope contents: write permission to the deploy job with an explanatory
  comment instead of workflow-level (CodeRabbit)
- Pin peaceiris/actions-gh-pages to the v4 commit SHA for supply-chain
  safety (CodeRabbit)
- Continue past per-notebook conversion failures and exit non-zero at the
  end so one bad notebook doesn't hide the rest (CodeRabbit)
@github-actions
github-actions Bot temporarily deployed to pull request July 6, 2026 22:11 Inactive
@giswqs
giswqs merged commit 8c2ccb7 into main Jul 6, 2026
10 of 11 checks passed
@giswqs
giswqs deleted the zensical branch July 6, 2026 22:11

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/docs.yml:
- Around line 21-24: The docs workflow build step can’t reliably find the
zensical console script because it may be installed under ~/.local/bin by pip
install --user. Update the workflow so the zensical command is available before
the build step in the docs job, either by removing --user from the pip installs
or by adding the user bin directory to PATH via GITHUB_PATH. Make the fix in the
workflow steps that install requirements and then run zensical build --clean
--strict.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bccc9964-ebe8-40e7-8bd9-eacf8288138b

📥 Commits

Reviewing files that changed from the base of the PR and between e23a8f8 and 06c0119.

📒 Files selected for processing (3)
  • .github/workflows/docs-build.yml
  • .github/workflows/docs.yml
  • scripts/convert_notebooks.py

Comment on lines +21 to +24
pip install --user -r requirements.txt -r requirements_dev.txt -r requirements_docs.txt
pip install --user .
# - name: PKG-TEST
# run: |
# python -m unittest discover tests/
- run: python -m pip install --upgrade pip
- run: pip install mkdocs-material mkdocstrings mkdocstrings-python mkdocs-git-revision-date-plugin mkdocs-jupyter ipykernel
- run: mkdocs gh-deploy --force
- run: python scripts/convert_notebooks.py
- run: zensical build --clean --strict

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does GitHub Actions ubuntu-latest runner include ~/.local/bin in PATH for run steps

💡 Result:

Whether the ~/.local/bin directory is included in the PATH on GitHub Actions ubuntu-latest runners is inconsistent and can vary depending on the specific runner image version and architecture [1]. While some versions of the Ubuntu-hosted runners include /home/runner/.local/bin in the default PATH [2][1], others do not [3][4][5]. Because this behavior is not guaranteed across all runner environments, it is recommended practice to explicitly add ~/.local/bin to your PATH if your workflow depends on binaries installed there (e.g., via pip) [4][1]. To add it to the PATH for the remainder of your job, you can use the GITHUB_PATH environment file [6][7]: - name: Add ~/.local/bin to PATH run: echo "$HOME/.local/bin" >> $GITHUB_PATH Alternatively, if you only need it for a single step, you can modify the PATH variable within that step's script [8]. It is generally best to avoid relying on the default inclusion of this directory to ensure your workflows remain portable and predictable [4][1].

Citations:


🏁 Script executed:

git ls-files .github/workflows/docs.yml .github/workflows/docs-build.yml && \
echo '--- docs.yml ---' && sed -n '1,120p' .github/workflows/docs.yml && \
echo '--- docs-build.yml ---' && sed -n '1,120p' .github/workflows/docs-build.yml

Repository: opengeos/segment-geospatial

Length of output: 3191


zensical needs to be on PATH before the build step. pip install --user can place the console script under ~/.local/bin, which GitHub Actions does not guarantee is on PATH for run: steps, so zensical build --clean --strict may fail with command not found. Drop --user, or add $HOME/.local/bin to GITHUB_PATH before the build step.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/docs.yml around lines 21 - 24, The docs workflow build
step can’t reliably find the zensical console script because it may be installed
under ~/.local/bin by pip install --user. Update the workflow so the zensical
command is available before the build step in the docs job, either by removing
--user from the pip installs or by adding the user bin directory to PATH via
GITHUB_PATH. Make the fix in the workflow steps that install requirements and
then run zensical build --clean --strict.

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.

2 participants