oficina / docs Public

Print, word count, and a shortcuts sheet that cannot go stale

Three of the gaps Paul named, and the last two fill the Tools menu that
has been sitting there greyed out since the menu bar landed.

PRINT is window.print() plus a stylesheet, deliberately not a second PDF
exporter — it is the browser printing the page you are looking at, and
the PDF export is a different thing with its own File item. @page
carries the geometry, matching pdf.go's own page size and margin, so
[docs-page] gives up its padding rather than insetting the text twice.
Widows, orphans and break-after on headings are the one typographic
courtesy print gives away free.

WORD COUNT segments with Intl.Segmenter rather than splitting on
whitespace. Whitespace finds no word boundary at all in Japanese or
Chinese — it would report 1 for a whole sentence — and this app declares
twelve base locales. A count is exactly the kind of number people quote
to each other, so being quietly wrong in eight of them is worse than
being slightly slower in all twelve. The selection row hides rather than
showing 0, because a zero cannot be told apart from an absence.

THE SHORTCUTS SHEET IS READ OUT OF THE MENU BAR'S OWN DOM. A shortcuts
screen is the most drift-prone thing in an application: every binding is
stated twice, and the second copy is wrong within a month. The bar
already renders every command's label and key, from the catalog, in the
reader's locale — so that is the source, and a shortcut that stops being
offered stops being documented automatically. The only rows written by
hand are the four bindings no menu item carries, and they are the four a
person most needs told: Tab and Shift+Tab are repurposed inside the
document, Backspace undoes an autoformat, Shift+Enter breaks a line.

Both dialogs are native <dialog> — modality, Escape, focus trapping and
the backdrop are all easy to get subtly wrong by hand and none of them
is the interesting part of either feature. Both are empty until opened
and carry no strings of their own; the bundle fills in numbers and rows.

Word count left the View menu, where it was listed twice.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 3a3b493dcac2ff86f613508729657f046c46e56a parent 2c40c62
11 files changed, +604 −18
  • .amadan/ci.d/10-gate +8 −0
  • fixtures/editor-entry.js +29 −0
  • fixtures/shortcuts.mjs +85 −0
  • fixtures/wordcount.mjs +118 −0
  • fixtures/wordcount.test.mjs +92 −0
  • internal/docs/handlers.go +57 −0
  • internal/docs/menu.go +2 −4
  • internal/docs/render.go +29 −0
  • internal/docs/static/editor.2c000feef616911e.js +0 −14
  • internal/docs/static/editor.32d42be3a13c49bf.js +14 −0
  • internal/docs/views/show.html +170 −0
.amadan/ci.d/10-gate

Loading diff…

fixtures/editor-entry.js

Loading diff…

fixtures/shortcuts.mjs

Loading diff…

fixtures/wordcount.mjs

Loading diff…

fixtures/wordcount.test.mjs

Loading diff…

internal/docs/handlers.go

Loading diff…

internal/docs/menu.go

Loading diff…

internal/docs/render.go

Loading diff…

internal/docs/static/editor.2c000feef616911e.js

Loading diff…

internal/docs/static/editor.32d42be3a13c49bf.js

Loading diff…

internal/docs/views/show.html

Loading diff…