Skip to content

fix(deploy): land mdBook v0.5.3 bump + brand.css rename onto main#16

Merged
keirsalterego merged 2 commits into
mainfrom
fix/mdbook-deploy-to-production
May 23, 2026
Merged

fix(deploy): land mdBook v0.5.3 bump + brand.css rename onto main#16
keirsalterego merged 2 commits into
mainfrom
fix/mdbook-deploy-to-production

Conversation

@keirsalterego

Copy link
Copy Markdown
Contributor

Summary

Brings the two unmerged fix commits onto main so the production Cloudflare Pages deploy actually picks them up.

When PR #13 and #14 merged earlier, they merged an EARLIER snapshot of feat/mdbook-site that did not yet contain these two commits. So main was missing the actual fixes and the production deploy at vyrox-docs.pages.dev was still showing the broken layout (both arrows on the same side, sidebar collapsed). Every push since has only triggered preview deploys because the fix commits stayed on feat/mdbook-site, not main.

What's in this PR

Two commits, cherry-picked from feat/mdbook-site:

  1. b315f81 fix(build): pin mdBook to v0.5.3 + remove duplicate README heading

    • scripts/build.sh: default MDBOOK_VERSION v0.4.40v0.5.3. v0.4 uses different chrome DOM selectors (.sidebar vs #mdbook-sidebar, no #mdbook-sidebar-toggle-anchor), so the CSS overrides we wrote against v0.5 silently did nothing on v0.4.
    • DEPLOY_CLOUDFLARE.md: same version update in the docs table.
    • README.md: drop the duplicate # Your AI Security Copilot H1 left behind by the foundation-rewrite merge, restore the project tagline blockquote.
  2. d70d90f fix(theme): rename variables.css -> brand.css to stop replacing mdBook's bundled vars

    • theme/css/variables.csstheme/css/brand.css
    • book.toml additional-css updated to point at the new name
    • Comment in book.toml explaining the rule so a future contributor does not repeat the collision

Why the rename matters

mdBook's theme override mechanism is full-file replacement, not a cascade. Any file dropped into theme/css/ whose name matches one of mdBook's bundled theme files (variables.css, general.css, chrome.css, print.css) replaces the bundled file outright.

Our theme/css/variables.css collided with mdBook's bundled theme/css/variables.css. mdBook used ours instead of its own, wiping out every default variable the layout depends on:

  • --page-padding (the .next arrow rule depends on it)
  • --sidebar-width: min(var(--sidebar-target-width), 80vw) (the formula that sizes the sidebar)
  • --sidebar-resize-indicator-width, --menu-bar-height, others

That broke:

  1. Both chapter arrows fell to the same position (the .next { right: var(--page-padding) } rule resolved to right: auto).
  2. The sidebar collapsed to its content min-width (~30px) and wrapped each chapter title character by character.

Renaming the override file to brand.css lets mdBook keep its own variables.css in the cascade and stacks our overrides on top.

After this merges to main

Cloudflare Pages production build kicks off on push to main. Once it completes (about 90 seconds for the cold mdBook download + build), vyrox-docs.pages.dev should show:

  • Previous-chapter arrow pinned to the left edge of the content area
  • Next-chapter arrow pinned to the right edge
  • Sidebar 290px wide with readable chapter titles
  • GitHub icon in the top-right next to print + edit
  • Dark theme throughout, no flash of white

Test plan

  • Merge this PR
  • Cloudflare Pages "Production" deployment kicks off (visible under Pages > vyrox-docs > Deployments, environment = "production")
  • After deploy completes, open vyrox-docs.pages.dev (force a hard refresh with Cmd+Shift+R / Ctrl+F5 to skip the cached build)
  • Confirm arrows on opposite edges, sidebar wide, GitHub icon present

Three deploy bugs the first Cloudflare render exposed:

1. Sidebar rendered ~30px wide with chapter titles wrapping after
   each character. Cause: scripts/build.sh pinned v0.4.40, but every
   CSS override in theme/css/ targets v0.5-only selectors
   (#mdbook-sidebar, #mdbook-sidebar-toggle-anchor, the
   nav-wide-wrapper layout). v0.4.x uses a different chrome DOM so
   our overrides did not match. Result: default sidebar width
   collapsed because :root --sidebar-target-width was set against
   v0.5 expectations.

2. GitHub icon missing from the top-right menu bar. v0.4 silently
   drops the `fab-github` icon name; v0.5 accepts it and renders
   the Font Awesome SVG.

3. README.md on main still had two H1s: "# Vyrox Security" then
   "# Your AI Security Copilot" with the project tagline gone.
   The fixup commit on docs/senior-rewrite-foundation was force-
   pushed AFTER PR #8 merged, so the merge landed the broken
   version. Apply the same fixup directly on this branch so the
   site renders one H1 plus the blockquote tagline.

Changes:

- scripts/build.sh: MDBOOK_VERSION default bumped v0.4.40 → v0.5.3.
  Matches the version we tested with locally. v0.5.3 binary is on
  GitHub releases (confirmed via curl); the existing tarball URL
  pattern resolves without change.
- DEPLOY_CLOUDFLARE.md: env var table updated to v0.5.3.
- README.md: drop the second "Your AI Security Copilot" H1 and
  restore the AI-security-copilot tagline as a blockquote.

Verified locally with mdbook v0.5.3:
- <html class="navy sidebar-visible"> on every page
- <nav id="mdbook-sidebar"> present so CSS overrides apply
- GitHub icon SVG rendered next to print + edit icons
- README has exactly one H1
…k's bundled vars

The actual cause of the broken sidebar and the both-arrows-on-the-
same-side bug was not the mdBook version. It was a file-name
collision.

mdBook treats any file in `theme/css/` whose name matches one of
its bundled theme files (variables.css, general.css, chrome.css,
print.css) as a FULL REPLACEMENT for the bundled file, not as an
override that cascades on top. Our `theme/css/variables.css` had
the same name as mdBook's bundled `theme/css/variables.css`, so
mdBook used our file instead of its own. Our file only contained
the dark-palette overrides; every other mdBook variable
(`--page-padding`, `--sidebar-width`, `--sidebar-resize-indicator-width`,
`--menu-bar-height`, etc) was wiped out.

The visible consequences:

1. `.next { right: var(--page-padding) }` resolved to
   `right: auto` because the var no longer existed. Both
   `.previous` and `.next` fell back to the same default position,
   producing the screenshot where both chapter arrows sat on the
   right edge.
2. The sidebar width calculation `min(var(--sidebar-target-width),
   80vw)` had no `--sidebar-width` aggregator to consume it, so
   the sidebar collapsed to its content-min-width (about 30px),
   wrapping each chapter title one character per line.
3. The chrome's resize-handle positioning relied on
   `--sidebar-resize-indicator-width`, which was also gone.

Fix: rename `theme/css/variables.css` to `theme/css/brand.css`. No
mdBook bundled file uses that name, so mdBook keeps its own
variables.css in the cascade and adds ours on top via
`additional-css`. Verified locally:

  - book/css/variables-*.css (mdBook's) now defines --page-padding,
    --sidebar-target-width: 300px (mdBook default), --sidebar-width
    formula, --menu-bar-height, etc.
  - book/theme/css/brand-*.css (ours) overrides --sidebar-target-width
    to 290px and the colour palette.
  - The two files no longer have identical content (they had
    matching md5 in the broken build because mdBook was using our
    file as both the bundled file AND the additional file).
  - The `.next { right: var(--page-padding) }` rule now resolves to
    a real 15px and our `nav.nav-wide-wrapper a.nav-chapters.previous
    { left: var(--page-padding) }` rule wins specificity and pins the
    previous arrow to the left edge.

Also documented the rule in book.toml so a future contributor does
not repeat the mistake.
Copilot AI review requested due to automatic review settings May 23, 2026 19:06
@keirsalterego keirsalterego merged commit 90b8cb4 into main May 23, 2026
1 of 2 checks passed
@keirsalterego keirsalterego review requested due to automatic review settings May 23, 2026 19:29
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