Long content
A long block in a document is cut at one height, fading out above a Show all bar: code shows the rest in place, a patch or an embedded file opens in the viewer.
API ContentFrame ContentTitleBar DocumentCard AttachmentViewerProvider FenceFrame PatchView JsonView Markdown
Cut every long block in a document the same way: at one height, fading out, with a Show all bar across its foot. A reader who has learnt it on one block reads them all, and nothing scrolls inside the page they are scrolling.
The pipeline now runs every step's tests:
steps:
- run: pnpm --filter step-1 test
- run: pnpm --filter step-2 test
- run: pnpm --filter step-3 test
- run: pnpm --filter step-4 test
- run: pnpm --filter step-5 test
- run: pnpm --filter step-6 test
- run: pnpm --filter step-7 test
- run: pnpm --filter step-8 test
- run: pnpm --filter step-9 test
- run: pnpm --filter step-10 test
- run: pnpm --filter step-11 test
- run: pnpm --filter step-12 test
- run: pnpm --filter step-13 test
- run: pnpm --filter step-14 test
- run: pnpm --filter step-15 test
- run: pnpm --filter step-16 test
- run: pnpm --filter step-17 test
- run: pnpm --filter step-18 test
- run: pnpm --filter step-19 test
- run: pnpm --filter step-20 test
- run: pnpm --filter step-21 test
- run: pnpm --filter step-22 test
- run: pnpm --filter step-23 test
- run: pnpm --filter step-24 test
- run: pnpm --filter step-25 test
- run: pnpm --filter step-26 test
- run: pnpm --filter step-27 test
- run: pnpm --filter step-28 test
- run: pnpm --filter step-29 test
- run: pnpm --filter step-30 test
- run: pnpm --filter step-31 test
- run: pnpm --filter step-32 test
- run: pnpm --filter step-33 test
- run: pnpm --filter step-34 test
- run: pnpm --filter step-35 test
- run: pnpm --filter step-36 testThe series that changed the fetch task:
From 4c1d2e8f0a9b7c6d5e4f3a2b1c0d9e8f7a6b5c4d Mon Sep 17 00:00:00 2001
From: alice <noreply@example.com>
Date: Tue, 20 Oct 2026 16:04:27 +0000
Subject: [PATCH 1/2] feat: retry a failed fetch once before giving up
A flaky network used to fail the whole task on its first error. One
retry, after a short pause, covers the common blip without hiding a
real outage.
---
src/fetch-task.ts | 14 +++++++++-----
src/retry.ts | 11 +++++++++++
2 files changed, 20 insertions(+), 5 deletions(-)
create mode 100644 src/retry.ts
diff --git a/src/fetch-task.ts b/src/fetch-task.ts
index 3b18e51..9f2c4a7 100644
--- a/src/fetch-task.ts
+++ b/src/fetch-task.ts
@@ -1,13 +1,17 @@
+import { retryOnce } from "./retry.ts";
+
export type Task = { id: string; title: string; done: boolean };
export async function fetchTask(id: string): Promise<Task> {
- const response = await fetch(`/api/tasks/${id}`);
- if (!response.ok) {
- throw new Error(`task ${id}: ${response.status}`);
- }
- return response.json();
+ return retryOnce(async () => {
+ const response = await fetch(`/api/tasks/${id}`);
+ if (!response.ok) {
+ throw new Error(`task ${id}: ${response.status}`);
+ }
+ return response.json();
+ });
}
export function isDone(task: Task): boolean {
return task.done;
}
diff --git a/src/retry.ts b/src/retry.ts
new file mode 100644
index 0000000..d1e5c0a
--- /dev/null
+++ b/src/retry.ts
@@ -0,0 +1,11 @@
+const PAUSE_MS = 250;
+
+/** Runs `attempt`, and once more after a pause if it throws. */
+export async function retryOnce<T>(attempt: () => Promise<T>): Promise<T> {
+ try {
+ return await attempt();
+ } catch {
+ await new Promise((resolve) => setTimeout(resolve, PAUSE_MS));
+ return attempt();
+ }
+}
--
2.47.0
From 7e6f5d4c3b2a1908f7e6d5c4b3a29180f7e6d5c4 Mon Sep 17 00:00:00 2001
From: bot-one <noreply@example.com>
Date: Wed, 21 Oct 2026 09:11:37 +0000
Subject: [PATCH 2/2] docs: say what fetchTask does on a network error
---
README.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/README.md b/README.md
index 5a1b2c3..6d7e8f9 100644
--- a/README.md
+++ b/README.md
@@ -3,3 +3,7 @@
## fetchTask
Loads one task by id.
+
+A network error is retried once, a quarter of a second later. A second
+failure, or any error status from the server, rejects with the status in
+the message.
--
2.47.0And the runbook the release follows:
An HTML attachment, which runs in its sandbox:
The cover letter the series was sent with:
A note with a long pipeline, a patch series, an embedded runbook, a page and a cover letter. Each is cut at the same height. Show all under the pipeline names its lines and draws the rest of them in place, and Show less cuts it again without moving the bar. Show all in the viewer under the patch, the runbook and the letter opens them in the attachment viewer, as ⤢ in their headers does; the page behind keeps them cut. The page stands at the cut's height and scrolls in its frame, with no bar.
When a block is cut#
- A code block past 30 lines is cut from the first frame, so a page rendered on the server does not jump. Its bar names how many lines it has.
- Any other block is measured: a patch, an embedded file, a block of your own. It is cut only when it is clearly taller than the cut, since a bar that shows a few lines more costs about what they do. It is measured again as it grows (an image arriving, a file unfolding) and as the window changes.
- A short block has no bar. ⤢ in its header stays the way into the viewer, and so does the name of a file with an address of its own.
Views that keep their own height#
A block the reader works in rather than reads down holds one height and scrolls inside it, so nothing the reader does in it cuts the card under them. It has no bar; ⤢ opens it in the viewer.
- A page (an embedded HTML file) stands at the cut's height, its width the card's, and scrolls in its frame. It loads once it is scrolled near.
- A tree (a JSON, YAML or TOML file shown as a tree) grows with its rows up to the cut's height, then scrolls in its box. Folding a node open never cuts the card, and search and Expand all scroll the box to what they find.
A message reads top to bottom, as a document does, so it is cut as one: measured, and opened in the viewer from its bar. Its HTML body is as tall as its page.
Where Show all goes#
The bar's icon and words say where the rest goes, by what the block is rather than by whether its header has a ⤢.
- In place, for text written into the document: a code block, a diagram's source, a log. The reader is reading it, and a dialog for the next few lines is a detour. The bar reads Show all with the block's line count when it shows its text line for line, and its chevron points down. Show less keeps the bar where it was on the screen and scrolls the page up to it.
- In the viewer, for a patch or an embedded file: what they hold reads better at the
viewer's size, with its file list and paging. The bar reads Show all in the viewer, with
the ⤢ of the header's Open in the viewer. Give
ContentCollapseanonOpen(a card'sonExpand, aFenceFrame'sopenOnCut) that opens the viewer. A command that takes the reader to something past the cut, such as a patch's files menu, lifts the cut in place all the same. - Where there is no viewer to open (no
AttachmentViewerProvider, a file the viewer cannot draw), or the block is already inside the viewer, the bar shows the rest in place. A reader can always reach the end of a block.
What stays in the page#
What is past the cut stays in the document, so find in page reaches it. When find in page, Tab or a link lands on something past the cut of a block that expands in place, the block opens and keeps that thing where it was on the screen. A patch or a code file drawn in a card shows only its first screen until it is opened: the rest is laid out when the reader asks for it.
Turning it off#
collapseLongFences={false} on Markdown leaves its code blocks whole and its patches in a
scroller of their own, for a review whose comments point at lines a cut would hide. A document
embedded in another follows its host. Embedded files are cut whatever it says: their length is
the file's, not the author's.
Blocks inside blocks#
Each block is cut on its own. A card cut above a long code block hides that block's bar too; the viewer shows the card whole, bar and all. A card shown in place opens itself, not the blocks inside it.
A block's header#
A block's header is a toolbar named by the block's name, and the name comes first: it keeps its first 20 characters, all of a shorter one, while the commands give way by the rules of toolbars. The header is as tall in every form.
Every block draws its commands from one set of parts, in one order out from the name:
- The marker, the name, then its meta: a size, a log's line count, a one-file patch's counts.
- The view's own commands: a search, a patch's files menu, a mode, Wrap lines.
- Source, held down while the text as written shows, on every file drawn as something other than its text. The view's commands stand left of it and come and go with the view, so switching views never moves what is under the pointer.
- The app's own commands, such as a card's version chips.
- Download, for a block that is or names a file.
- Open in the viewer (⤢), on a block the viewer draws bigger or better than the page.
- Copy, always last, the text as written in either view.
With a pointer their words hide first, then they go into a ⋯: Download and ⤢ before the view's
commands, then Source, and Copy last of all, being what a block is most often used for. Source
outlasts the rest of them: it is the way to the text Copy copies.
⤢, the bar and the name open the viewer on what the block shows: a card showing a diagram's source opens the viewer on the source, and one showing the drawing, on the drawing. Every opening starts over from there, and so does every page in the viewer; nothing carries from one file to the next.
The name names and the commands act. A file with an address of its own has a name that is a link to it: a plain click opens the viewer and a modified or middle click follows the link, as a row in a file list does. Any other name is plain text, with its whole value in a tooltip. A name never downloads; Download is its own command.
The viewer's title bar is the same header one step out, at the next size: the same marker, name and order, with Open in new tab where ⤢ stands, since the reader is in the viewer already, then a rule and the viewer's own paging, Maximize and Close. Its footer only reports: the file's type and size, or an inline block's tag, and what the view says about what is shown.
A renderer drawn in a card or the viewer puts its controls in the title bar it is lent: it asks
useContentTitleBar for the slot and fills it with ContentTitleBarControls. There they are the
header's own commands, giving way and taking the arrow keys as the card's do. They are drawn in
the header, so they read what is around the header, not what is around the renderer: hand them
what they need.
Lent a bar, a view draws no frame and no bar of its own: the card or the viewer is its frame, and
names it and offers its download already, so the view draws neither again. Its commands and its
search go into the bar, and the text it copies goes to the bar's one Copy through
ContentTitleBarCopy, so a bar never shows two. A count of what it holds, a log's lines, goes
after the card's name through ContentTitleBarMeta. What belongs to the content itself and is
read at a glance stays on the view, a band of its own under the bar: a log's level chips, with its
line count at their end. The viewer lends its footer too, for what the view reports about what is
shown: a renderer asks useContentStatusBar for that slot, and a log's line count and a hex
dump's selection follow the file's type and size there.
The header is one Tab stop. Tab lands on the name when it is a link that opens the block, and
the arrow keys walk the commands and the ⋯, so a page of blocks costs a Tab each.
A block of your own#
Build it from the same parts, so it is cut as every other block is: ContentFrame for the edge,
ContentHeader for the name and controls, and ContentCollapse around the header and a
ContentCollapseBody. The commands every block shares are parts of their own,
ContentSourceToggle, ContentDownload, ContentOpen and ContentCopy, each with its icon,
words and place in the order fixed; the view's own are toolbar parts themselves (ToolbarButton,
ToolbarItem). A name that links to the file is a ContentName, which the arrow keys reach. A
view that lays out only what is on screen reads useContentCollapse to size its box. A renderer
drawing into a card that fills it edge to edge marks its root data-content-flush, and the card
drops its padding around it; the viewer, too, takes such a view out to its sides and up to its
title bar. A strip of the view's own lines up with the surface's bar by --content-inset, which
the viewer sets and a card leaves to the view's own default.
On each platform#
Desktop & pointer#
- The header and the bar are each a row tall, and the bar is one target across the block's whole width.
Touch#
- The header and the bar grow to a finger's height. Nothing about the cut needs hover: the fade and the bar are always there.
- A name that opens the viewer takes a tap across the header's height, and is drawn as it is with a pointer.
- A header's commands keep their words; what does not fit goes into its
⋯whole.
Print#
- A printed page has no bar to press: blocks print whole, and a patch or a code file drawn in a card prints the screen it shows.