Skip to content

feat(library): LaTeX in descriptions, and essays for machines and collections - #119

Merged
thethinkmachine merged 1 commit into
feat/library-latex-supportfrom
claude/inspiring-lovelace-ak678d
Sep 30, 2026
Merged

thethinkmachine merged 1 commit into
feat/library-latex-supportfrom
claude/inspiring-lovelace-ak678d

Conversation

@thethinkmachine

@thethinkmachine thethinkmachine commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

What

Two commits:

  1. cfd40b8 feat(library): Machine descriptions now support latex (from feat/library-latex-support, which never had a PR of its own). An author's description, write-up and a collection's blurb take $…$ / $$…$$, typeset by KaTeX in the Library view, the submit form's preview and on the website (js/tex.js).
  2. 6795008 feat(library): essays for machines and collections, which builds on (1). A machine or a collection can now carry an essay: a Markdown file beside it (bb5.md beside bb5.automaton, busy-beavers.md beside its collection). Both the website and the app's Library view show it after the showcase, with a contents list in the margin, numbered figures and footnotes.

How (essays)

  • js/library/article.js: a small Markdown dialect shared by both faces: headings, lists, quotes, tables, code, $…$/$$…$$, [^n] footnotes, links. Code spans and math are set aside first, and everything is escaped before any tag is written. Links are limited to http(s), # and lib:<id>.
  • Facts come from the library, not the author. {{steps}}, {{ones}}, {{cells}}, {{states}}, {{size}}, {{standard}}, and {{steps <other id>}}, are read off the index by js/library/essay.js: the same analysis that earns the badges. They're set in mono with a dotted underline so readers can tell them from the author's words.
  • Figures are drawn from the machine: ::: spacetime, ::: growth, ::: diagram, ::: machines <ids> (js/library/article-figures.js), with arguments clamped in essayFigureSpec. The website draws them at build time. The app draws them in a worker (essay-draw.js, essay-figures.worker.js) so BB(5)'s 47M steps don't block the UI, and caches the result.
  • Index and build: entries and collections get essay: { path, hash, minutes } (validated by essayRef in index-model.js). writeLibrary serves the .md beside its machine, only when the machine was published.
  • App: fetchEssayText uses the same hash-checked, cached path as a machine's file, so a tampered essay is refused and a read one works offline. Ids are prefixed (lib-essay-) because the essay shares the app's document. Footnote, contents and lib: clicks are handled in the view, so they never write location.hash, which carries share links.
  • Build feedback: unknown facts, undrawable figures, dead lib: links and missing footnotes are reported as warnings on the entry's report (the PR comment), not errors.
  • Guard: an essay has no credit of its own, so guard.mjs credits it as its machine. The machine's author or a maintainer may write it, and nobody else may attach one. An essay with no machine beside it is refused. Previously every .md read as "credits @(nobody)" and was rejected even from the author.
  • Fixed on the website too: facts shrank twice inside table cells, and uppercase table headers turned S(n) into S(N).
  • Docs: an Essays section in .claude/skills/library/SKILL.md, and a bullet in library-template/CONTRIBUTING.md.

Testing

  • New tests/essay.test.js (16): dialect, escaping (<script>, javascript:/data: links), code and math left untouched, fact lookup ({{constructor}} is not a fact), footnote order, id prefixing, figure numbering and bounds, the simulator against BB(2), and essayRef rejecting ../, //, non-.md and URL paths.
  • tests/library.test.js (+10): the index and served files (an essay beside a failing machine is not served), the report's warnings, the guard, the website page, and the Library view (essay rendered after the showcase and before Behaviour, replaces Notes, a tampered essay is refused, the collection essay). The LaTeX commit's own tests are in the same file.
  • Mutation-checked: removing the escaping, the own-name guard, the id prefix or the hash check each fails at least one test.
  • npm test on this branch: 2599 pass, 1 skipped. vite build emits essay-figures.worker-*.js.
  • Checked by hand in the running app and on the built website (light and dark) against a local build of the library with the essays from thethinkmachine/automata-library#4.

Merge order

Merge this before thethinkmachine/automata-library#4: the library is built and guarded by this repo's main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L8hKpV2hiVoJMZ9f6X4Zwu

A machine or a collection can now carry an essay: a Markdown file beside
it (bb5.md beside bb5.automaton, busy-beavers.md beside its collection).
The website and the app's Library view both show it after the showcase,
with a contents list, numbered figures and footnotes.

- js/library/article.js: a small Markdown dialect shared by both faces.
  Code and math are set aside first and everything is escaped before any
  tag is written; links are limited to http(s), # and lib:<id>.
- {{steps}}, {{ones}}, {{size}}, {{steps <id>}} and friends are read off
  the index (js/library/essay.js), so the numbers in the prose are the
  ones the badges were earned by.
- ::: spacetime / growth / diagram / machines draw figures from the
  machine (js/library/article-figures.js), with arguments bounded. The
  website draws them at build time; the view draws them in a worker.
- The index lists essay: { path, hash, minutes }; the build serves the
  file beside its machine, and the view fetches it through the same
  hash-checked, cached path as a machine's file.
- The build reports an essay's unknown facts, undrawable figures and
  dead lib: links as warnings on the entry, so authors see them on the PR.
- guard.mjs credits a machine's essay as its machine: its author or a
  maintainer may write it, nobody else may attach one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L8hKpV2hiVoJMZ9f6X4Zwu
Copilot AI balanced review requested due to automatic review settings September 30, 2026 14:29
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@thethinkmachine
thethinkmachine merged commit 5da0d2b into feat/library-latex-support Sep 30, 2026
11 of 12 checks passed
@thethinkmachine
thethinkmachine deleted the claude/inspiring-lovelace-ak678d branch September 30, 2026 14:37
@thethinkmachine thethinkmachine changed the title feat(library): essays for machines and collections feat(library): LaTeX in descriptions, and essays for machines and collections Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants