8 min readPost 36
After 90 blog images: why our diagrams shrank to ant-sized text, and how we built a zero-CDN lightbox
By 34 bilingual posts and 90 WebP images, every automated blog check was green—yet opening the latest posts on a desktop screen revealed 1600px multi-column diagrams shrunk into unreadable ant tracks with no way to zoom. On 29 November we rebuilt our diagrams at 760–800px logical width @2x with prose-grade typography, replaced drawings with real sanitized captures, and added a 229-line zero-CDN Vue lightbox that cleans up across SPA language switches.

On this page
By late November, Obituary's development blog had grown to 34 bilingual posts and 90 WebP images. On every build, site/blog/.vitepress/posts.test.mjs verified the whole set: every file under 300 KB, at most 1600 px wide, exact width and height matching the WebP header, lazy loading, and full alt text and captions. Every automated check was green.
Then we opened the four newest posts on a real 1440×900 laptop screen and tried to read them start to finish. The problem jumped right off the page:
You couldn't read the labels inside our architecture diagrams—and clicking an image did nothing.
Labels that looked sharp at 12 px in a full-size preview shrank into blurry ant tracks once dropped into the article column. Reading a function name meant right-clicking "Open image in new tab" and zooming manually. On 29 November we stopped to fix the whole visual pipeline (fc63039): redoing our diagram canvas and typography rules, swapping drawn approximations for real sanitized captures, and shipping a zero-CDN native lightbox across both static builds.

Doing the pixel math: why a 1600 px wide diagram always turns blurry inline
Three numbers in the stylesheet explained the whole failure:
- The article prose column is
--column: 46rem(736 px at a 16 px root font). Even with horizontal figure bleed (--bleed), an inline diagram peaks around 880 px. - A post's first figure also becomes its top banner (
PostPage.vue). To keep tall screenshots from pushing the headline off-screen,bannerSizecapped banner height at36rem(576 px), while the dotted.stagemat consumed up to3rem(48 px on each side) of padding. - Meanwhile, our four architecture diagrams from 25–28 November had been laid out as wide
1600×820to1600×880multi-column canvases with 11–13 px labels.
Drop a 1600 px canvas into a 736 px reading column and the browser shrinks it to ~45%. Those crisp 12 px labels collapse to 5.5–6 px on screen—barely legible in English and smeared solid in Chinese. Exporting higher resolution does not solve that; as long as the diagram's logical width is double the reading column, the type will always render half-size.
Fixing readability at the source: 760–800 px logical @2x, ≥15–16 px type, and a taller banner cap
Instead of drawing giant landscape canvases and hoping readers zoom in, we rewrote our diagram spec around the actual reading column:
- Design at column width, export at @2x: Every diagram now uses a 760–800 px logical canvas rendered at 2× device scale (
1600 pxphysical WebP). Inside the 736–800 px column it displays near 1:1 logical scale—crisp on HiDPI screens and never squashed on standard displays. - Stack vertically and match prose type: Multi-column side-by-side cramming gave way to clean stacked vertical sections with 15–16 px body labels (right alongside the blog's
1.0625rem/17 pxprose) and no wide decorative frames. - Unpinch
PostPage.vue: We raisedbannerSize's height cap from36remto68rem(keepingaspectRatiopre-sized for zero layout shift) and tightened.stagepadding fromclamp(0.75rem, 4.5vw, 3rem)down toclamp(0.5rem, 1.4vw, 1rem)so the diagram gets the pixels instead of the dotted border.
All eight Chinese and English diagrams across the 25–28 November posts were rebuilt to this spec, naturally growing taller so every box breathes:
| Diagram | Before (W × H) | After (zh) | After (en) |
|---|---|---|---|
doctor-and-list | 1600 × 860 | 1600 × 1672 | 1600 × 1674 |
quota-plan-a | 1600 × 820 | 1600 × 1698 | 1600 × 1912 |
tray-win32-sequence | 1600 × 820 | 1600 × 1570 | 1600 × 1696 |
admission-and-osroot | 1600 × 880 | 1600 × 1976 | 1600 × 2118 |
Real sanitized captures beat drawn mockups
Diagrams earn their place for architecture and state machines, but when the real UI already runs, drawing a fake mockup wastes time and hides real details. In the same pass we added four real sanitized captures in both languages (bringing the blog from 90 images to 94):
- Live
obit doctorHTML diagnostic report (doctor-report.zh/en.webp): Generated by actually runningobit doctorinside an isolated demo directory (C:\Users\Public\obit-demo\doctor-shot), expanding a failing area to show the copyable yellow fix commands and the 1-day auto-burial footer—never touching personal paths. - Live
obit-guicalendar multiselect (calendar-multiselect.zh/en.webp): Captured directly from the desktop window using sample data with Tomorrow's column header selected and the floating squircle batch capsule active at the bottom.
Every new image also gets a full-size visual check before commit. posts.test.mjs catches oversized files, wrong dimensions, and path leaks, but only a human eye catches awkward line breaks or cramped labels.
A 229-line zero-CDN native Vue lightbox built for dual static builds
Even when diagrams read comfortably inline, readers still click dense captures and timelines expecting them to expand.
We deliberately skipped external lightbox CDNs and third-party gallery packages. Obituary's site builds twice on every release—GitHub Pages (dist/) and the mainland China mirror (dist-cn/), where the mirror enforces zero external network requests. Bringing in a third-party viewer also tends to fight VitePress's SPA router on cleanup.
site/blog/.vitepress/theme/ImageLightbox.vue solves the whole job in 229 lines of plain Vue 3, zero new npm packages, mounted once inside Layout.vue. The real engineering lives in four edge cases:
- Selective event delegation: A single document click listener checks
.post .banner .stage img, .post .post-body figure img, .post .vp-doc img, ignoring non-left clicks, modifier keys (Ctrl/Cmd/Shift/Alt), images inside<a>or<button>,.svgicons, tiny assets under120×120, and explicit.no-lightbox/data-no-lightboxopt-outs. - Zero ghost modals or stuck scroll locks across SPA navigation: Switching Chinese ↔ English in VitePress or hitting browser Back swaps routes without a page reload. If a lightbox stays mounted or leaves
document.documentElement.style.overflow = 'hidden'behind, the next page freezes. Watching() => route.pathto callclose(), backed byunlockScroll()insideonBeforeUnmount, guarantees clean teardown on every route exit. - Accessible dialog semantics and focus return: The backdrop exposes
role="dialog"andaria-modal="true"with localized labels fromcopy.ts(lightboxDialogandlightboxClose). Opening moves focus to the close button onnextTick; closing viaEsc, backdrop click, or the button restores focus totriggerEl(whenisConnected) using{ preventScroll: true }so the reader never loses their scroll position. - Restrained cues and reduced-motion support:
PostPage.vueandprose.cssaddcursor: zoom-inand a subtlescale(1.006)hover hint. Inside the dialog, the image scales cleanly withinmax-width: 92vw; max-height: 82vhabove its original<figcaption>, and@media (prefers-reduced-motion: reduce)disables transitions automatically.

Reading through the updated posts afterwards felt completely different: every architecture diagram is legible straight in the column, and a single click opens any real capture full-screen. Automated tests catch broken images and missing metadata, but actually reading the rendered site like a visitor is still the only way to catch text that technically exists yet nobody can read.