8 November 2026

Blocks, not HTML

nimib exists to make custom blocks easy, so that a page says what it shows and not how it is drawn: nbTable t rather than a <div> around a string of HTML. tabelline's pages drifted the other way. They write HTML inside nbText, paste it with nbRawHtml, carry their own <style> and <script>, and write colours as hex values where they need them. This post measures how far the drift went, proposes the blocks that would replace it (one of them works already, below), says where styles and colours should live, and what a nimib skill should teach so that agents, which wrote most of these pages, don't drift again.

This page has no HTML in its text and no nbRawHtml: it is written only with nimib's blocks, tabelline's nbTable and the first custom block.

How far it drifted

Every .nim file under docs/ was read on 8 November 2026 (the numbers are kept as a dated snapshot, so they stay what they were when this was written). Outside the theme, the 18 pages call nbRawHtml 35 times, write HTML tags inside 25 nbText blocks, carry 10 <style> and 5 <script> blocks of their own, and write 101 distinct hex colours between them.

HTML, CSS and colours in the pages
per source file, on 8 November 2026
nbRawHtmlnbText with HTML<style><script>style=hex colours
living documents
design.nim6320714
specs.nim601107
index.nim410101
explainer.nim1310012
coverage.nim010005
roadmap.nim010001
agents.nim010000
posts
devlog/palettes.nim7421931
devlog/tabellone.nim121234
devlog/design_review.nim41101720
devlog/designing_0_1.nim411005
devlog/skills.nim110000
devlog/day_one.nim011001
devlog/month_of_building.nim020000
devlog/two_looks.nim010000
devlog/operetta.nim010000
devlog/three_threads.nim010000
devlog/index.nim100000
theme and helpers
quaderno.nim2011022
munari.nim000207
parti.nim001018
blocchi.nim000000
Counted in the sources on 8 November 2026; snapshot in devlog/data/blocks-review/audit.tsv. The theme and its helpers may hold CSS: that is their job. style= counts inline styles.

Three kinds of drift show up:

  1. Page furniture written by hand. The kicker and lede at the top of nearly every page, the cards of the home page and the devlog, the galleries of three posts: the same HTML, copied.
  2. Styles and scripts per page. 8 pages carry a <style> block, and some carry a script, so a component looks slightly different on each page and can't be fixed in one place.
  3. Colours where they are used. Hex values in pages and in table options, outside the palette (the design review counts the colours; here they are counted with everything else).

The new pages of this week's restructure (the Design Ref and the design review) are among the worst: they were written fast, with HTML, which is the drift this post is about.

The blocks that would replace it

Each recurring piece of HTML becomes a block with a name that says what it is. Here they are, from the simplest to the most complex, with where they are used today:

Blocks for tabelline's pages
proposed names; nbIndice and nbTabs exist
what it showshow it is done todaywhere
nbTitolo(kicker, title, lede)the top of a page: what it is, its title, one paragraph<p class="kicker">, # title, <p class="lede"> by hand17 pages
nbNota(text, kind)a note with a meaning: info, done, missing, warning (with the triangle)nbNota(text, color) with a colour name6 pages
nbCards: nbCard(title, href, text)a grid of cards that link to pages<div class="cards"> and notes by handhome, devlog, Design Ref
nbIndicethe table of contentsa block alreadymost pages
nbTabs(python, r): bodythe same example in Nim, Python and Ra template that renders blocks into a stringexplainer, posts, book
nbShowCode: bodytables with their code folded belownew in the Milano Cortina post1 post
nbBeside: bodysmall tables side by side<div class="affiancate"> inside a gallery card1 post
nbGalleria(label): nbScheda(title): bodya row of cards to swipe, each any blocksa hand-made template with nb.blocks.setLen and HTML strings, per post4 pages
nbTinte(tokens)colour swatches with names and uses<ul> of swatches with inline stylespalettes, Design Ref, design review
nbParti(t)a table with a button that shows its partsHTML, a button and a script on the home pagehome
nbSpecs, nbPaletteSwitch, nbGridthe few interactive pieces: the specs filter, the palette picker, the tabellone grid<script> in the page3 pages

A first block, working

nimib makes a block with newNbBlock: a type with its fields and a toHtml that renders it. A block that holds other blocks inherits from NbContainer, and nb.withContainer collects what its body adds. So a gallery is two small blocks and two templates, in docs/blocchi.nim (the name is provisional):

import std/strformat
import nimib

newNbBlock(NbGalleria of NbContainer):
  label: string
  toHtml:
    &"""<div class="nb-galleria" tabindex="0" aria-label="{blk.label}">""" & nbContainerToHtml(blk, nb) & "</div>"

newNbBlock(NbScheda of NbContainer):
  title: string
  toHtml:
    &"""<div class="nb-scheda"><h3>{blk.title}</h3>""" & nbContainerToHtml(blk, nb) & "</div>"

template nbGalleria*(what: string, body: untyped) =
  ## A row of cards to swipe sideways; `what` says what they are, for screen readers.
  let galleria = newNbGalleria(label = what)
  nb.withContainer(galleria):
    body
  nb.add galleria

template nbScheda*(heading: string, body: untyped) =
  ## One card of a gallery: a heading, then any blocks (text, code, tables). Cards are numbered
  ## by the theme.
  let scheda = newNbScheda(title = heading)
  nb.withContainer(scheda):
    body
  nb.add scheda

Here it is in use. The cards hold ordinary blocks: text, code that runs, a table. The page says a gallery of cards, not how one is drawn:

Text

A card holds any blocks. This one holds only text, written in Markdown.

Code

Code runs where it is, and its output follows it.

echo 6 * 7
42

A table

And a table made with tabelline.

risultato
2 × 36
4 × 520
6 × 742

The gallery of Designing tabelline 0.1 does the same with a 25-line template that renders blocks into a string of HTML, cuts them off the page (nb.blocks.setLen) and pastes the string back with nbRawHtml; each post that wanted a gallery copied its CSS too. With the block, the CSS is in the theme once, the cards are numbered by it, and the blocks inside stay blocks (a Markdown backend could render them too).

Where things should live

Three places, and a page uses them without knowing what is inside:

  1. A style module (docs/stile.nim, say): every styling decision. The tokens of the design review as Nim constants, the CSS of both looks generated from them, the fonts. No colour and no CSS anywhere else, so changing a colour is one line.
  2. A blocks module (docs/blocchi.nim, or my.nim as in your earlier projects): every custom block of the pages, each documented. Pages import it and use blocks only.
  3. Data modules, as today (piano.nim, mese.nim): what a page shows, kept apart from how.

docs/quaderno.nim today mixes all three (the CSS, the blocks nbIndice, nbTabs, nbNota, and the header): it would split into the first two. nbRawHtml stays for a true one-off, with a comment that says why it is not a block.

Tables are the exception that proves the rule: they already are a block (nbTable), but their colours come from optQuaderno() and from hex values in tabStyle. A table preset that reads the tokens (the design review's choice 5) puts their colours in the style module too.

The rules

For AGENTS.md, and for whoever writes the next page:

  1. A page uses blocks. Markdown in nbText, nimib's blocks, nbTable, and the project's custom blocks. No HTML tags in nbText.
  2. Repeated HTML becomes a block in the blocks module, the second time it is needed, not the third.
  3. No styles or colours in a page. CSS and colours live in the style module; a page that needs a new look for something needs a new block, or a new token.
  4. nbRawHtml is a last resort, for a one-off, with a comment saying why.
  5. CI counts the drift. The audit above becomes a check (tools/drift.nim) that fails when a page adds HTML, a <style> or a colour outside the allowed list.

A nimib skill against drift

Most of these pages were written by agents, quickly, and an agent reaches for HTML because it knows HTML better than it knows nimib's block API. A nimib skill should change that default. What it should say:

The skill would start in your personal skills repository, as you suggest, and move to nimib (or a nimib-land repository) once it has proved itself. The earlier nimib skills (closed nimib#264) have a custom blocks reference to start from.

Choices to make

  1. Names. Blocks module blocchi.nim (Italian like quaderno, piano, parti) or my.nim; style module stile.nim or tema.nim. Recommended: blocchi.nim and stile.nim.
  2. The theme files. quaderno.nim and munari.nim fold into stile.nim (both looks) and blocchi.nim (header, footer, blocks), or stay as they are with only the new modules added. Recommended: fold them: one place each for style and blocks.
  3. Posts. Dated posts keep their words, but their code is migrated to blocks too, or they are left as they were written. Recommended: migrate: the code is not the post, and a post left with its own CSS breaks when the theme changes.
  4. The CI check. Fails on new drift (with an allow list for the theme), or only reports. Recommended: fail, once the migration is done.

What happens next

One PR, after this post and the design review are agreed: the style module with the tokens, the blocks module with the blocks above, every page moved to them (the living documents first, then the posts), the table preset, the drift check in CI, the rules in AGENTS.md, and the Design Ref rewritten around the blocks: for each block, what it shows, when to use it, and how it looks in both looks. The skill is drafted alongside, in your skills repository.

How it is built

The audit read every .nim file under docs/ and counted, per file: calls of nbRawHtml; nbText blocks whose triple-quoted text holds an HTML tag (<div, <p, <span, <a href, …); <style and <script; inline style="; and distinct #RRGGBB values. Files are grouped as living documents, posts, or theme and helpers (where CSS belongs); data modules are left out. It ran once and was saved as docs/devlog/data/blocks-review/audit.tsv: the post is dated, so its numbers stay those of 8 November 2026 while the pages are migrated (the live count will be a check in CI, tools/drift.nim, that reads the pages every time). The code of docs/blocchi.nim above is the module as it was on 8 November 2026, kept in docs/devlog/data/blocks-review/blocchi.nim: the blocks module has grown since, and the gallery is drawn with the same two blocks.