Web pages: a link to any address opens as an article, as Wikipedia's do

A url link now opens in the app instead of the browser. The server fetches
the page (robots.txt honoured, public addresses only, size and time caps),
keeps a snapshot on disk until it is reloaded, and cuts it into a lead and
sections: by its headings, else by pseudo-headings, else in chunks, or by a
model when asked (s), within a daily budget. The pane has its own amber
ground, the author and date in its head when the page gives them, and the
source in its foot. W opens the original, R reads it again. See
docs/pages.md.

Pictures and videos are kept, in web pages and in Wikipedia articles:
pictures through the server (only addresses seen in a page that was read),
videos as a still that loads the player on a click.

A section that is only a link (a target, no text, no sections) opens as
its article at once, and L opens a target to the right of the node's own
pane, never under it.

Article text is sized to read like the reader's own.

Panes: a pane that already has all its column can give beside the others'
tabs no longer peeks over them on hover, and the curves of tabs under a
peeking pane are no longer drawn over it. The keypress timing test judges
each of its two passes on its own, so a stall from outside the app does
not fail it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Fable 5.2 committed 2026-11-18 13:44:13 -05:00
1 parent a3f25fbdcc
commit f8c6576ea1
58 files changed
+8606 -367

No files matched your search

+6 -3
View File
@@ -360,7 +360,8 @@ test("linking by hand: the picker links to the library, to Wikipedia and to an a
await page.keyboard.type("https://example.org/tides");
await expect(picker.locator(".choice.selected")).toContainText("example.org");
await keys(page, "Enter");
expect(await linkCount()).toEqual([`${word}|wiki|Octopus`, `${second}|url|https://example.org/tides`]);
// The page's title is asked for first (the mock web has none for this address), so the link lands a moment later.
await expect.poll(linkCount).toEqual([`${word}|wiki|Octopus`, `${second}|url|https://example.org/tides`]);
// /link with a target in the text form, on the node itself: the node is about something.
await keys(page, "Escape Escape");
await command(page, "/link w:Tide");
@@ -483,8 +484,10 @@ test("a hostile article cannot run script or load anything from elsewhere, in a
await keys(page, "j l");
await page.waitForTimeout(300);
const text = page.locator(".wiki-text");
expect(await text.locator("script, iframe, object, embed, img, svg, style, link, form, video, base, meta").count()).toBe(0);
expect(await text.evaluateAll((els) => els.flatMap((e) => [...e.querySelectorAll("*")]).flatMap((e) => [...e.attributes].map((a) => a.name)).filter((n) => /^on|^style$|^src|^srcset$|^background$/.test(n)))).toEqual([]);
// Pictures are kept, so img may appear, but only from the app's own image route; a video only as its facade (no <video> before a click).
expect(await text.locator("script, iframe, object, embed, svg, style, link, form, video, audio, source, base, meta").count()).toBe(0);
expect(await text.evaluateAll((els) => els.flatMap((e) => [...e.querySelectorAll("*")]).flatMap((e) => [...e.attributes].map((a) => a.name)).filter((n) => /^on|^style$|^srcset$|^srcdoc$|^background$|^poster$/.test(n)))).toEqual([]);
expect(await text.evaluateAll((els) => els.flatMap((e) => [...e.querySelectorAll("[src]")]).map((i) => `${i.localName} ${i.getAttribute("src")}`).filter((s) => !s.startsWith("img /api/wiki/media?u=https%3A%2F%2Fupload.wikimedia.org%2F")))).toEqual([]);
expect(await text.evaluateAll((els) => els.flatMap((e) => [...e.querySelectorAll("a[href]")]).map((a) => a.getAttribute("href")!).filter((h) => !/^https:\/\//.test(h)))).toEqual([]);
for (const a of await text.locator("a[target]").all()) expect(await a.getAttribute("rel")).toContain("noopener");
// The heading with markup in it is shown as text.