Note

How this site is made

A colophon: the static site generator, the in-browser PK engine, the writing tools and the hosting behind The Working Model.

2 min read

This is a static site. Every page is built ahead of time into plain HTML. Apart from a little for the theme switch and search, the JavaScript a reader downloads belongs to the interactive parts of a post, and is loaded once they scroll into view.

Writing

Posts are Markdown files, with MDX when a post needs a component. Each post sits in its own folder with its figures, data and references. A quick post like this one is plain Markdown, written in VS Code with Front Matter CMS, which gives a form for the title, date and tags and leaves the text alone.

Equations are TeX, rendered by KaTeX when the site is built, so they need no JavaScript to read. Citations come from a BibTeX file next to the post and are formatted in the Vancouver style, and footnotes become margin notes on wide screens. Code blocks, NONMEM control streams included, are highlighted by Expressive Code.

Interactive posts

The site is built with Astro. Interactive parts are React components that Astro renders as “islands”: the page around them is static, and each one starts up on its own when it comes into view. Charts are drawn with Observable Plot. A chart the reader cannot change is rendered to SVG when the site is built, and ships no JavaScript.

The pharmacokinetic simulations run in your browser. The engine is written in TypeScript: closed-form solutions for linear one- to four-compartment models, an ODE solver (with a stiff method) for everything else, and population simulation with between-subject variability. Heavy simulations run in a Web Worker, a background thread, so the page stays responsive. The engine is tested against reference results from mrgsolve, with explicit tolerances. R is used offline for those references and for static figures, and is never sent to the reader.

Look

Headings are set in Newsreader, text in Public Sans and code in Fira Code, all served from this site. Colours come from one set of design tokens, with a light and a dark theme that are both checked for contrast.

Hosting

The source lives in a Git repository. Every change goes through a pull request, where continuous integration type-checks, lints, tests and builds the site, checks its internal links and deploys a preview. Merged changes are deployed to Cloudflare as static files. Search is Pagefind, an index built with the site that runs in the browser, so there is no search server.