twinBASIC documentation

twinBASIC is a modern, from-scratch reimplementation of Visual Basic 6 and VBA — the classic language, compiler and IDE, brought forward. Sunderland Ober Consulting maintains its documentation at docs.twinbasic.com: we author and edit the content, run the build, and deploy the site. It remains a community project — several people contribute — but the day-to-day maintenance and the tooling are our job.

The documentation

The site is large — over 900 pages and ca. half a million words — and most of it is reference material: the twinBASIC language, its statements and operators, and the thirteen packages that ship with it (the VBA and VB compatibility libraries, WebView2, and more). The site also covers the IDE (its windows, menus, and project settings), includes tutorials, and describes what twinBASIC adds to the classic language. It was built from a much smaller start, and its content comes from three sources:

Keeping it correct

Documentation for a compiler is only useful if it is right, so claims are checked against the real thing. Every twinBASIC code sample on the site — ca. 1,200 of them — is either compiled with the twinBASIC compiler (ca. 1,130) or marked as a deliberate fragment, with the reason recorded. Where the behaviour of the IDE is in doubt, we measure it: a test harness drives the real IDE, and ca. 40 claims in the docs have been corrected that way.

Every change is built and run through some twenty automated checks before it goes live — among them a link check across all three outputs (the online site, the offline mirror, and the book), and an accessibility scan of representative pages against WCAG 2.2 AA in both the light and dark themes.

Finding things

We also reworked the site's search. When that work began, a search for a documented name such as PaintPicture put the right page in the top ten results only about one time in five. On our evaluation set of ca. 10,000 queries — documented names, plus page titles and questions phrased in prose — the right page now comes first ca. 98% of the time.

Outgrowing Jekyll

The site began as a Jekyll build on the just-the-docs theme. As the page count grew, so did the build — into the low double-digit seconds for a full run — and profiling put the cost squarely in Liquid, Jekyll's template layer. We moved the hot work out of templates and into Ruby plugins: HTML minification, the book's chapter lists, per-page metadata, and admonition parsing were all precomputed instead of re-rendered page by page. That bought back real time — but it also made the ceiling clear. What remained was mostly Markdown parsing itself — much of it the book re-parsing pages the site had already rendered — and no amount of Liquid tuning would remove it.

A build tool of our own

So we replaced Jekyll. tbdocs is a from-scratch static-site generator we wrote in Node.js — around fifty modules, no template engine, no Ruby toolchain. It follows the same content model and produces the online site, an offline file://-browsable mirror, and the source of the print-ready PDF book. The build also generates the site's search index, highlights twinBASIC code, draws diagrams, and checks links. A full build takes a few seconds on a modern laptop; each published build's timings appear as a live build graph.

The speed is in the architecture: the build is a task graph run in parallel across every CPU core. Worker threads pull ready tasks from a scheduler kept in shared memory. A --serve mode keeps a warm pool of workers, watches the content tree, and pushes live reloads to the browser as you edit.

Fittingly for a documentation project, the generator is documented as part of the site it builds — its architecture, pipeline, and internals live in a Documentation Development section on docs.twinbasic.com itself.

The book

The ca. 2,250-page PDF book was its own story. We render it by driving paged.js — a library built to lay out paged media interactively in a browser — under headless Chromium, then finish the PDF with pdf-lib. Out of the box, rendering the book (ca. 1,650 pages at the time) took ca. 3.5 minutes, close to two of them in paged.js layout alone. Profiling found a quadratic trap: every finished page stayed in the live document, so laying out each new page paid for all the pages before it. Taking finished pages out of the document, together with further fixes to paged.js and pdf-lib, cut layout time more than tenfold and the whole render to about a minute. The book has grown since, and now renders in a couple of minutes as a separate step after the site build; it ships with every documentation release.

Jan's work on the twinBASIC documentation has been hugely important, and I really can't thank him enough. Without his help, our documentation would still be rudimentary and, frankly, nowhere near good enough. He's delivered a full-scale online manual, a downloadable PDF, and all the build infrastructure around it so that he and our community can maintain it and keep improving it. It's an enormous contribution to the project, and one that I appreciate a great deal.

He is incredibly thorough and professional, and never seems to be content with what he's already achieved. He's always looking at what could be better, always pushing for perfection, and that shows in the quality of his work. He's also a thoroughly nice person, which makes working with him a real pleasure. We're very lucky to have him involved in our project.