A versioned documentation site, built with Zensical and published to GitHub Pages, beside the wiki¶
Context and Problem Statement¶
Bylaw's documentation is in two places, and neither matches the version a user has installed.
- The README, about 1,000 lines in 19 sections, has become the user guide: writing policies, operators, missing fields, counts, every effect, initiatives, converting, building and testing.
- The wiki (ADR-0037) has generated reference pages: the exported commands, the keywords, and the 190 diagnostic codes. It is published from
mainon every push, so it describesmain, not a release. - Since 0.5.0-alpha, every diagnostic carries a link to its section in the wiki (
[BylawDiagnostic]::WikiUrl, ADR-0037), and so does every release on the PowerShell Gallery. A user of 0.5 who follows a link reads aboutmain. Until 1.0 that's mostly the same thing; after 1.0 a renamed parameter or a changed diagnostic would send them to the wrong advice.
Milestone 8 adds documentation that matches each release, before 1.0. Where is it built and hosted, with what, and how do the links that releases already carry keep working?
Decision Drivers¶
- A user reads the documentation of the version they have installed, and a diagnostic's link leads there.
- Every link in a published release keeps working: the wiki links in 0.5 to 0.7, and the site links from then on.
- The generated reference pages stay generated from the source, with the tests ADR-0037 added. Nothing is maintained twice.
- The guide is written once, in Markdown in the repository, and reviewed in pull requests with the code it describes.
- A pull request that breaks the site fails its checks. A preview of the site is a bonus.
- The build runs where PowerShell and PlatyPS already run: the reference pages need the module loaded.
- No running cost, and nothing to maintain that the project can't keep up with. It should outlast Material for MkDocs, which is in maintenance mode.
Considered Options¶
- Zensical, with its fork of
mikefor versions, published to GitHub Pages from GitHub Actions - MkDocs with Material for MkDocs and
mike, published to GitHub Pages - Read the Docs, building MkDocs or Zensical, with its own versions
- The wiki only, with a page set per version
Decision Outcome¶
Chosen option: "Zensical, with its fork of mike, published to GitHub Pages from GitHub Actions", because it builds where the reference pages are already generated, costs nothing, versions the site per release, and doesn't depend on Material for MkDocs past its end of life. A Zensical project is also a valid Material for MkDocs project, so the second option stays a fallback with no change to the pages.
Pages¶
- Guide, written by hand in
docs/site/guide/: the README's sections, split into pages: getting started, writing policies, operators and missing fields, counts, effects (Modify,Append,DenyAction,Manual,AuditIfNotExistsandDeployIfNotExists), raw conditions, initiatives, converting existing policies, building and settings, and testing policies. The README keeps the overview, install, quick start and "before and after", and links to the site. - Reference, generated at build time into the site, as ADR-0037 generates them for the wiki: commands (PlatyPS), keywords, and diagnostics by range, with a section per code. One generator writes both outputs. The site's page and anchor names match the wiki's, so the same tests check both.
- Decisions: the ADRs, copied from
docs/adr/at build time, so the reasoning that diagnostics cite is on the site too. - Navigation is generated with the reference pages, so a new keyword or diagnostic range appears without editing a file.
Generated pages are never committed (ADR-0037).
Versions¶
- One site version per minor release, such as
0.7. A patch release replaces its minor's pages. Each version is built from the release's commit by the release job, withmike deploy --push --update-aliases 0.7 latest. latestis an alias for the newest release.- The site's root is a landing page above the versions, added 2026-12-01: an example beside the JSON it compiles to, why Bylaw is useful, and links into
latest. The build compiles the example fromdocs/landing/, so the page shows Bylaw's real output, and checks that everylatest/link is a page on the site. It is published whenever a version becomeslatest, so it describes the newest release. devis built frommainon every push, as the wiki is now, and the version selector labels it as unreleased.- Prerelease versions share their minor's version:
0.7.0-alphais published as0.7. Until 1.0 every release is a prerelease, so this is one version per milestone release. - Versions from 0.5 to 0.7, which shipped wiki links, aren't rebuilt. Their links lead to the wiki.
Links from diagnostics¶
[BylawDiagnostic]::HelpUribecomes the site's page for the installed version:<site>/<major>.<minor>/reference/Diagnostics-BYL2xxx/#byl2005, the wiki's page and anchor names. The version comes from the module's manifest at run time, so a build ofmainlinks todev.- The wiki keeps being published from
mainwith the same generator, so the links in 0.5 to 0.7 keep working and stay current. ItsHomepage and sidebar say that the site has the documentation for each version. - A test checks that each catalogued code's link names a generated page and section on the site, as ADR-0037's test does for the wiki.
Build and publishing¶
./build/build.ps1 -Task Sitegenerates the reference pages, copies the ADRs, and runszensical buildintoout/site. Python and Zensical are pinned in a requirements file, as PlatyPS is inbuild/requirements.psd1.- On a pull request, CI builds the site with broken links and missing pages as errors, and uploads it as a workflow artifact to download and open. GitHub Pages has no previews per pull request; if one is wanted later, a preview service can serve the artifact.
- On
main, the release job deploysdev. When it publishes a release, it also deploys the release's minor version and moveslatest.mikecommits to thegh-pagesbranch, so the job needs no extra secret. - GitHub Pages serves the
gh-pagesbranch.
Address¶
Decided 2026-12-01: https://bylaw.cloud/, a custom domain, set once as site_url in docs/site/mkdocs.yml. The build writes the CNAME file that GitHub Pages reads at the root of gh-pages from it, with the landing page, so a deploy can't drop the domain. bylaw.dev was taken. Until then the site was built for https://wragg.io/PowerShell-Bylaw/, the repository's own Pages address under the maintainer's user site domain; GitHub redirects it, and markwragg.github.io/PowerShell-Bylaw/, to the custom domain. The options were:
https://wragg.io/PowerShell-Bylaw/, with no setup: the repository's Pages address, under the maintainer's user site domain. If the repository later moves to an organisation, GitHub doesn't redirect Pages, so released links would break unless the old site is kept as redirects. It also ties the project's links to a personal domain.https://<org>.github.io/<repo>/, after moving the repository to its own organisation first.- A custom domain, which survives any move of the repository, for a domain registration each year. Chosen.
Consequences¶
- Good, because each release has documentation that matches it, and its diagnostics link to it.
- Good, because the reference pages, their tests and the wiki carry on as ADR-0037 describes. The site is one more output of the same generator.
- Good, because the README shrinks to a front page, and each guide page can grow without making it harder to find the install instructions.
- Good, because a Zensical project also builds with Material for MkDocs 9.7, the fallback if Zensical stalls.
- Bad, because the build gains Python and Zensical. They run only in the site task and in CI, never in the module.
- Bad, because Zensical is young: its versions are below 1.0, and its
mikefork gets fixes but no features until native versioning replaces it. The fallback limits the risk. - Bad, because moving the guide out of the README changes where people look. The README links to each guide page from the section it replaces.
- Neutral, because the README examples that tests check, the quick start and the before and after (
tests/Meta/Repository.Tests.ps1), stay in the README. The guide's other examples aren't checked today. A test that compiles every completePolicyblock in the guide pages would be a gain, and is worth adding with the split.
Confirmation¶
CI builds the site on every pull request, with link checking. The catalogue and link tests check that every diagnostic code has a section on the site and in the wiki. After the first release with site links, a check of a diagnostic link from the released module, in a clean session, confirms it leads to that version's page.
Pros and Cons of the Options¶
Zensical, with its fork of mike, published to GitHub Pages from GitHub Actions¶
Zensical is the MIT-licensed successor to Material for MkDocs, by the same team. It reads Material for MkDocs projects. It supports versions through a fork of mike, and its maintainers plan native versions that will replace the fork.
- Good, because the build runs in GitHub Actions, where PowerShell, PlatyPS and the module already are.
- Good, because it is maintained, where Material for MkDocs gets only critical fixes until about May 2027.
- Good, because GitHub Pages is free for a public repository, and
mikeneeds only the default token. - Neutral, because a theme or plugin that Zensical doesn't support doesn't run. The site needs only the theme, search and the version selector.
- Bad, because it is below 1.0, and the
mikefork is installed from GitHub, not PyPI.
MkDocs with Material for MkDocs and mike, published to GitHub Pages¶
- Good, because it is the most widely used setup, documented in Material's own guide, with
mikeintegrated. - Good, because 9.7 made every former sponsor-only feature free.
- Bad, because Material for MkDocs is in maintenance mode, with critical fixes only until about May 2027, and MkDocs itself has been little maintained. The site would need to migrate within a year or two.
Read the Docs, building MkDocs or Zensical, with its own versions¶
- Good, because versions from Git tags, a version selector and a preview per pull request are built in.
- Bad, because its builds run on Read the Docs' own Linux images. Generating the reference pages there needs PowerShell and PlatyPS installed by custom build commands, and the build would run twice: in CI, where the tests are, and on Read the Docs.
- Bad, because the free plan shows ads on community projects.
- Bad, because the address is
bylaw.readthedocs.iounless a custom domain is added, and the project depends on another service's account.
The wiki only, with a page set per version¶
- Good, because it adds nothing new.
- Bad, because a GitHub wiki has no versions. Page sets per version, such as
0.7-Diagnostics-BYL2xxx, would multiply the pages and the sidebar with every release. - Bad, because the wiki can't be built or checked on a pull request, and has no search beyond GitHub's.
More Information¶
- Milestone 8 in
docs/SPEC.mdalso plans a conversion gallery: real policy definitions shown beside the bylawConvertTo-Bylawwrites for them. It is built into the same site, as generated pages, once the site exists. It isn't part of this decision. - Material for MkDocs' maintenance status and end of life: its changelog and releases. Zensical's
mikesupport: release 0.0.30.