Skip to content

Record the theme version on generated PDFs - #40

Merged
sehkone merged 1 commit into
mainfrom
sehkone/issue-33
Aug 8, 2026
Merged

Record the theme version on generated PDFs#40
sehkone merged 1 commit into
mainfrom
sehkone/issue-33

Conversation

@sehkone

@sehkone sehkone commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Closes #33. Stacked on #39 — based on sehkone/issue-38, because both change build-docs-pdf.sh and tests/pdf-test.sh. Merge #39 first and this rebases to a clean diff.

Why

Both places the installed version is recorded are deliberately kept out of the build: docs/theme/.meta is dot-prefixed so MkDocs drops it, and docs/theme.toml is in exclude_docs. That exclusion is right — theme machinery should not be published — but it left nothing in a generated PDF saying which theme rendered it.

A site is a git log away from that answer. A PDF is handed to a reader and leaves the repository that produced it, and once four projects bump the theme on their own schedules the answer stops being inferable at all.

What the cover carries

docs-theme 1.2.3          # a downloaded install
docs-theme (local build)  # a --source install, ko: docs-theme (로컬 빌드)

Two decisions worth flagging:

  • The value comes from .meta, not theme.toml. .meta records what is installed; theme.toml records only what was requested. Reading the latter would let a drifted or hand-edited tree misreport itself as a release.
  • A --source install does not print its version. That number came from theme.toml and never resolved a release, so printing it would assert something untrue. It names the build instead.

A missing .meta is an error. A cover that quietly omits the line is the same class of silent asset loss as the 404 stylesheets this whole effort started from.

It reaches the template through extra, the way cover_tagline does, and is overwritten rather than honoured if a consumer sets it — this is derived, not configured.

Verification

tests/pdf-test.sh gains three checks, all passing:

  • a --source build renders the local marker and not a version number
  • rewriting .meta to source = "release" makes the cover print docs-theme 1.2.3, and the local marker disappears — this is what proves the value is read from .meta
  • removing .meta fails the build with the file named

Also: both samples build --strict, shellcheck and markdownlint-cli2 clean.

Note

scripts/ci-build-pdf.py builds the sample PDFs directly from templates/ and shared/ rather than through an installed docs/theme/, so sample covers render without the line — the {% if %} guard in the template handles it. It is repo-internal and not part of the consumer surface, so it is left alone.

Base automatically changed from sehkone/issue-38 to main August 8, 2026 07:09
A PDF is handed to a reader and leaves the repository that produced it.
Both places the installed version is recorded are deliberately kept out
of the build -- .meta is dot-prefixed and MkDocs drops it, theme.toml is
in exclude_docs -- so nothing in the artifact said which theme rendered
it. A site is a git log away from that answer; a PDF is not, and once
four projects bump the theme on their own schedules it stops being
inferable at all.

The cover now carries the line. It reads .meta rather than theme.toml
because .meta records what is installed and theme.toml only what was
requested, so a drifted tree cannot misreport itself.

A --source install takes its version from theme.toml without ever
resolving a release, so printing that number would assert something
untrue. It renders an explicit local-build marker instead.

A missing .meta is an error. A cover that quietly omits the line is the
same class of silent asset loss the rest of this pipeline exists to
prevent.

Closes #33
@sehkone
sehkone merged commit 2d6fc3c into main Aug 8, 2026
6 checks passed
@sehkone
sehkone deleted the sehkone/issue-33 branch August 8, 2026 07:20
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.

Record the theme version on generated PDFs

1 participant