// The videos on the docs pages (docs/assets/clips/, recorded by scripts/docs-clips.js) follow one // pattern, and their files exist. The strict build checks neither: // - The build rewrites a as a link relative to the Markdown file, but leaves `poster` as it // is. The page is served one folder deeper (fields.md is use/fields/), so the poster takes one "../" more. // - A clip plays only when asked: controls, no autoplay (WCAG 2.2.2), muted, nothing loaded before. // - A caption says in words what the clip shows (WCAG 1.2.1), and the video names it as its description. import { test } from "node:test"; import assert from "node:assert/strict"; import { existsSync, readFileSync } from "node:fs"; import { basename, dirname, join, relative, resolve } from "node:path"; import { filesUnder, root } from "./source-files.js"; const docs = join(root, "docs"); const FIGURE = /]*>([\s\S]*?)<\/figure>/g; const attr = (tag, name) => tag.match(new RegExp(`\\b${name}(?:="([^"]*)")?(?=[\\s>])`))?.[1] ?? (new RegExp(`\\b${name}(?=[\\s>=])`).test(tag) ? "" : undefined); /** The folder a page is served from: use/fields.md is use/fields/, an index.md its own folder. */ const servedDir = (page) => (basename(page) === "index.md" ? dirname(page) : page.replace(/\.md$/, "")); /** Every
with a