[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115140":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":24,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":15,"lastSyncTime":28,"discoverSource":29},115140,"xeet","rauchg\u002Fxeet","rauchg","X posts rendered to PNG without a browser, in safe Rust and WebAssembly.","https:\u002F\u002Fxeet-rs.vercel.app",null,"JavaScript",148,12,1,2,0,83,3,71.64,"Apache License 2.0",false,"main",[],"2026-11-20 19:09:27","2026-11-22 14:28:07","# xeet\n\n**[xeet-rs.vercel.app](https:\u002F\u002Fxeet-rs.vercel.app)**\n\nxeet draws X posts exactly the way X draws them, without a browser. Hand it a\npost, or just an `x.com` link, and you get back a Retina PNG that matches what\nChrome shows on x.com: the same line breaks, the same emoji, the same fallback\nfonts, and \"Show more\" in the same place.\n\nMost preview tools boot headless Chromium and take a screenshot. xeet\nreimplements the parts a post actually depends on instead: X's client rules,\nBlink and HarfBuzz text layout, the flexbox geometry around the text, and\nSkia-style anti-aliasing. All of it is safe Rust (`#![forbid(unsafe_code)]`).\n\nIt ships as one native binary and one WebAssembly core, plus six font packs the\nhost registers on first use. Once those are loaded, a text post renders in\n2.8 ms (p50, 390 px at 3×), or 4.5 ms with four media placeholders. Rendering\nneeds no network, no filesystem, no clock and no system fonts, and the native\nand WASM builds produce the same bytes. CI checks Linux x64, Linux arm64, macOS\nand WASM against each other on every run.\n\n## Gallery\n\nEvery image below is `xeet`'s own output, rendered in both light and dark themes so GitHub matches your appearance setting.\n\n\u003Ctable>\n\u003Ctr>\n\u003Ctd width=\"50%\" valign=\"top\">\n\u003Cpicture>\u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs\u002Fgallery\u002Fnasa-dark.webp\">\u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"docs\u002Fgallery\u002Fnasa-light.webp\">\u003Cimg src=\"docs\u002Fgallery\u002Fnasa-light.webp\" alt=\"NASA Goddard's #280characters space field rendered by xeet\">\u003C\u002Fpicture>\u003Cbr>\n\u003Cb>Emoji as layout.\u003C\u002Fb> \u003Ccode>@NASAGoddard\u003C\u002Fcode>'s 2017 space field: runs of preserved spaces, Apple Color Emoji and a hashtag, placed by hand.\n\u003C\u002Ftd>\n\u003Ctd width=\"50%\" valign=\"top\">\n\u003Cpicture>\u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs\u002Fgallery\u002Frauchg-math-nested-dark.webp\">\u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"docs\u002Fgallery\u002Frauchg-math-nested-light.webp\">\u003Cimg src=\"docs\u002Fgallery\u002Frauchg-math-nested-light.webp\" alt=\"Mathematical digits, Show more cut, and nested quote rendered by xeet\">\u003C\u002Fpicture>\u003Cbr>\n\u003Cb>Math digits, Show more &amp; nested quote.\u003C\u002Fb> Unicode math bold digits fall back to STIX Two Math, cut with block \u003Ccode>Show more\u003C\u002Fcode> above a depth-2 quote.\n\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n**[Browse all 17 edge-case renders (Web & iOS, carousels, polls, video posters, CJK\u002FRTL) in `docs\u002FGALLERY.md` →](docs\u002FGALLERY.md)** — or try any post interactively in the [playground](https:\u002F\u002Fxeet-rs.vercel.app).\n\n## Features\n\n- **Matches Chrome, and proves it.** Text, layout, cards and pixels are all\n  checked against real headless Chrome: zero line-break and zero height\n  mismatches on the text oracle, 147\u002F147 frame rows per theme, 192\u002F192 card rows,\n  and 159\u002F159 captured posts end to end. See\n  [How the tests work](#how-the-tests-work).\n- **Follows X's own rules.** [`SPEC.md`](SPEC.md) records every rule along with\n  its evidence (the JS chunk, the function, the captured payload) for\n  `x-web@55591fe0`, the version X serves today.\n  [`crates\u002Fxeet-core\u002Frules\u002Fx-web.json`](crates\u002Fxeet-core\u002Frules\u002Fx-web.json) is the\n  machine-readable copy the renderer runs.\n- **Resolves links without owning the network.** [`xeet-resolve`](crates\u002Fxeet-resolve\u002Fsrc\u002Flib.rs)\n  turns tweet text or an `x.com` URL into a complete `Post`, but the caller\n  supplies every byte of I\u002FO (`Fetch`, `Lookup`, `Cache`, `Clock`). The core\n  stays a pure function, and the network policy stays yours.\n- **Runs wherever you need the image.** One core, three targets: a WebAssembly\n  module for browsers and Node ([`packages\u002Fxeet`](packages\u002Fxeet\u002F)), a native\n  Rust library ([`crates\u002Fxeet-core`](crates\u002Fxeet-core\u002Fsrc\u002Flib.rs),\n  [`crates\u002Fxeet-resolve`](crates\u002Fxeet-resolve\u002Fsrc\u002Flib.rs)), and the `xeet` CLI\n  ([`crates\u002Fxeet-cli`](crates\u002Fxeet-cli\u002Fsrc\u002Fcommands\u002Fmod.rs), packaged for\n  `npm i -g @xeet\u002Fcli` by [`tools\u002Fship\u002Fpackage-cli.mjs`](tools\u002Fship\u002Fpackage-cli.mjs)).\n- **Deterministic down to the byte.** [`xeet-core`](crates\u002Fxeet-core\u002Fsrc\u002Flib.rs)\n  does no I\u002FO, no core crate uses `unsafe`, and native and WASM output have\n  identical SHA-256 hashes on 24 of 24 cases.\n- **Handles the long tail.** Bidi, CJK, kaomoji, multi-codepoint emoji, nested\n  quotes, cards, polls, video, the web\u002FiOS differences, and safe link resolution.\n  The full list is under [What it handles](#what-it-handles).\n\n## Running it\n\n```bash\n$ vercel dev\n```\n\n`vercel dev` runs [`tools\u002Fship\u002Fvercel-build.mjs`](tools\u002Fship\u002Fvercel-build.mjs)\nand serves the WebAssembly playground locally. To build and test from source:\n\n```bash\n$ npm run build                  # runs the CI test gates, builds wasm, writes dist\u002F\n$ npm test                       # contract, unsafe, golden stamps, and wasm package tests\n$ cargo test --workspace         # rules, text, layout, paint, resolver, iconic posts\n\n$ cargo build --release --bin xeet\n$ xeet render post.json --width 390 --theme dark --dpr 3 -o post.png\n```\n\nThe Chrome parity oracle needs one dev dependency of its own: `pnpm --dir tools install`.\n\n## API\n\n### JavaScript & WebAssembly\n\n```sh\nnpm i @xeet\u002Fcore\n```\n\n```ts\nimport { loadXeet } from \"@xeet\u002Fcore\u002Fnode\";\n\nconst xeet = await loadXeet(); \u002F\u002F Promise\u003CXeet> (singleton per process)\n\nconst report = xeet.explain(post, { width: 390, theme: \"dark\", dpr: 3 });\n\u002F\u002F → Report: { ruleset, verifiedFor, size: { width, height }, length, text, entities, hidden, attachment, warnings }\n\nconst { png, report: same } = xeet.render(post, { width: 390, theme: \"dark\", dpr: 3 });\n\u002F\u002F → { png: Uint8Array, report: Report }  (PNG dimensions: ceil(report.size.width * dpr) × ceil(report.size.height * dpr))\n\nif (xeet.hasShowMore(post, { surface: \"web-timeline\", width: 390 })) {\n  const expanded = xeet.render(post, { surface: \"web-timeline\", width: 390, expanded: true });\n}\nconst sheet = xeet.sheet({ post, widths: [382, 390, 600], themes: [\"light\", \"dark\"], dpr: 2 });\n\u002F\u002F → Uint8Array (single labeled PNG grid)\n```\n\nIn the browser, initialize the WebAssembly module and bind the same [`Xeet`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L280) surface:\n\n```js\nimport init, * as wasm from \"\u002Fwasm\u002Fxeet_wasm.js\";\nimport { bind } from \"@xeet\u002Fcore\";\n\nawait init();\nconst xeet = bind(wasm); \u002F\u002F Xeet\nconst { png, report } = xeet.render(post, { width: 390, theme: \"light\", dpr: 2 });\n```\n\n#### Methods & return values ([`Xeet`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L280) · [`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L80))\n\n| Call | Return type | Description & source definition |\n| --- | --- | --- |\n| `loadXeet(options?)` | `Promise\u003CXeet>` | Node\u002FBun\u002FDeno async loader (`{ lazy?: boolean }`) — [`node.d.ts`](packages\u002Fxeet\u002Fsrc\u002Fnode.d.ts#L14) · [`node.js`](packages\u002Fxeet\u002Fsrc\u002Fnode.js#L93) |\n| `loadXeetSync(options?)` | `Xeet` | Synchronous Node singleton loader — [`node.d.ts`](packages\u002Fxeet\u002Fsrc\u002Fnode.d.ts#L16) · [`node.js`](packages\u002Fxeet\u002Fsrc\u002Fnode.js#L106) |\n| `bind(wasm)` | `Xeet` | Browser\u002Fworker wrapper over initialized `wasm-bindgen` exports — [`types.d.ts`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L334) · [`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L80) |\n| `xeet.render(post, options?)` | [`RenderResult`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L160) (`{ png: Uint8Array, report: Report }`) | Encoded PNG bytes + layout [`Report`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L134) — [`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L111) · [`render.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frender.rs#L263) |\n| `xeet.renderPng(post, options?)` | `Uint8Array` | Encoded PNG bytes alone — [`types.d.ts`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L290) · [`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L117) |\n| `xeet.renderRgba(post, options?)` | [`RgbaResult`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L168) (`{ width, height, rgba: Uint8Array, report: Report }`) | Device-pixel dimensions + straight-alpha RGBA8 (`width × height × 4` bytes) + `Report` — [`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L125) · [`render.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frender.rs#L220) |\n| `xeet.renderMany(post, optionsList)` | [`BatchItem[]`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L180) (`{ png: Uint8Array, report: Report, paint: number }[]`) | Decodes `post` media once across multiple `RenderOptions`; `paint` is render ms — [`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L148) · [`render.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frender.rs#L286) |\n| `xeet.explain(post, options?)` | [`Report`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L134) | Layout boxes, character count, entities, and rule decisions with zero rasterization — [`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L95) · [`render.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frender.rs#L180) |\n| `xeet.hasShowMore(post, options?)` | `boolean` | `true` when `post` renders with `\"Show more\"` collapsed under `options` — [`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L104) · [`render.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frender.rs#L196) |\n| `xeet.sheet({ post, widths?, themes?, dpr? })` | `Uint8Array` | Labeled `widths × themes` contact sheet PNG — [`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L190) · [`render.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frender.rs#L329) |\n| `xeet.resolve(input, options?, host?)` | `Promise\u003C`[`Resolved`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L267)`>` | Hydrates text, an `x.com` URL, or JSON into `{ post, links, media, source, warnings }` — [`resolve.js`](packages\u002Fxeet\u002Fsrc\u002Fresolve.js#L169) · [`xeet-resolve`](crates\u002Fxeet-resolve\u002Fsrc\u002Flib.rs#L449) |\n| `xeet.resolveLinks(url, options?, host?)` | `Promise\u003C`[`ResolvedLink`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L238)`>` | Crawls one URL as `Twitterbot\u002F1.0` → `{ meta, chain, finalUrl, tags, imageUrl, image?, notes, cached }` — [`resolve.js`](packages\u002Fxeet\u002Fsrc\u002Fresolve.js#L185) · [`xeet-resolve`](crates\u002Fxeet-resolve\u002Fsrc\u002Flib.rs#L422) |\n| `xeet.whatwgHost(parts?)` | [`Host`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L190) | Wraps `fetch` + optional DNS `lookup` & cache callbacks — [`resolve.js`](packages\u002Fxeet\u002Fsrc\u002Fresolve.js#L41) |\n| `xeet.upstream` | `string` | Embedded X web-client revision hash (e.g. `\"55591fe0\"`) — [`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L92) |\n\n#### `Report` shape ([`types.d.ts`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L134) · [`model.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fmodel.rs#L275))\n\n- `ruleset: string` — X ruleset version (e.g. `\"x-web@55591fe0\"`).\n- `verifiedFor: Surface[]` — surfaces verified against Chrome for this ruleset.\n- `size: { width: number, height: number }` ([`Size`](crates\u002Fxeet-core\u002Fsrc\u002Fmodel.rs#L297)) — frame box in CSS pixels; PNG pixel dimensions are `Math.ceil(size.width * dpr)` × `Math.ceil(size.height * dpr)`.\n- `length: { weighted: number, limit: number, valid: boolean }` ([`Length`](crates\u002Fxeet-core\u002Fsrc\u002Fmodel.rs#L290)) — X weighted character count (URL = 23, emoji\u002FCJK = 2; standard limit = 280).\n- `text: { lines: number, truncated: boolean, hasShowMore: boolean, showMore: \"inline\" | \"clamped\" | null, visible: string }` ([`TextReport`](crates\u002Fxeet-core\u002Fsrc\u002Fmodel.rs#L304)) — rendered line count, `\"Show more\"` mode (`\"inline\"` web UTF-16 cut vs `\"clamped\"` iOS 9-line clamp), and displayed text.\n- `entities: { kind: \"url\" | \"mention\" | \"hashtag\" | \"cashtag\", range: [number, number], text: string, display?: string }[]` ([`Entity`](crates\u002Fxeet-core\u002Fsrc\u002Fmodel.rs#L317)) — UTF-16 `[start, end]` code-unit offsets into `post.text`.\n- `hidden: { range: [number, number], why: string }[]` ([`Hidden`](crates\u002Fxeet-core\u002Fsrc\u002Fmodel.rs#L328)) — UTF-16 ranges stripped from visible text (`\"reply_mentions\"`, `\"quote_url\"`, `\"media_url\"`).\n- `attachment: { shown: \"card\" | \"media\" | \"quote\" | \"poll\", url?: string | null, why: string } | null` ([`Attachment`](crates\u002Fxeet-core\u002Fsrc\u002Fmodel.rs#L335)) — winning attachment and rule reason.\n- `warnings: string[]` — non-fatal notes (such as missing image bytes drawn as a placeholder).\n\nA [`Post`](crates\u002Fxeet-core\u002Fsrc\u002Fmodel.rs#L16) ([`types.d.ts`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L78)) requires only `text`:\n\n```json\n{\n  \"text\": \"We just shipped the thing.\",\n  \"author\": { \"name\": \"Vercel\", \"handle\": \"vercel\", \"verified\": \"business\", \"squareAvatar\": true },\n  \"media\": [{ \"kind\": \"video\", \"width\": 1280, \"height\": 720, \"duration\": 11.7 }],\n  \"links\": { \"https:\u002F\u002Fvercel.com\u002Fblog\u002Fx\": { \"card\": \"summary_large_image\", \"title\": \"…\" } },\n  \"quote\": { \"text\": \"…\", \"author\": { \"name\": \"…\", \"handle\": \"…\" } },\n  \"poll\": { \"choices\": [\"Yes\", \"No\"], \"votes\": [58, 42] },\n  \"counts\": { \"replies\": 131, \"reposts\": 55, \"likes\": 5264, \"views\": 37047269 },\n  \"createdAt\": \"2026-11-10T06:00:00Z\",\n  \"now\": \"2026-11-10T09:00:00Z\"\n}\n```\n\n[`RenderOptions`](crates\u002Fxeet-core\u002Fsrc\u002Fmodel.rs#L216) ([`types.d.ts`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L9)) is `{ surface?: \"web-timeline\" | \"web-detail\" | \"ios-timeline\" | \"ios-detail\", width?: number, theme?: \"light\" | \"dark\", dpr?: number, fontScale?: number, expanded?: boolean }`.\nLimits are enforced in [`limits.rs`](crates\u002Fxeet-core\u002Fsrc\u002Flimits.rs), published as JSON Schema in [`packages\u002Fxeet\u002Fsrc\u002Fschemas.js`](packages\u002Fxeet\u002Fsrc\u002Fschemas.js) (with MCP tool descriptors in [`packages\u002Fxeet\u002Fsrc\u002Fmcp.js`](packages\u002Fxeet\u002Fsrc\u002Fmcp.js)). Validation and limit failures throw [`XeetError`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L316) ([`abi.js`](packages\u002Fxeet\u002Fsrc\u002Fabi.js#L32) · [`render.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frender.rs#L50)) with `{ code: string, status: 400 | 413 | 500 | 503, fields: { path, message, suggestion? }[], notes: string[] }`.\n\n#### Resolution & `Resolved` shape ([`types.d.ts`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L267) · [`xeet-resolve\u002Fsrc\u002Flib.rs`](crates\u002Fxeet-resolve\u002Fsrc\u002Flib.rs#L322))\n\nResolution takes its network from the caller — `fetch` is externalized, never imported, and the library follows redirects itself:\n\n```js\n\u002F\u002F input: tweet text, an x.com status URL, or post JSON.\nconst resolved = await xeet.resolve(input, { media: true, width: 390, dpr: 2 }, {\n  fetch: (request) => fetch(request.url, { redirect: \"manual\", headers: request.headers }),\n  lookup: (host) => dns.resolve(host),         \u002F\u002F optional: enables the DNS-hop SSRF guard\n  cacheGet: async (key) => store.get(key),     \u002F\u002F optional: { value, storedAt } | null\n  cacheSet: async (key, value, storedAt) => store.set(key, { value, storedAt }),\n});\n\u002F\u002F resolved: {\n\u002F\u002F   post: Post,                                \u002F\u002F pass directly to xeet.render(resolved.post, options)\n\u002F\u002F   links: Record\u003Cstring, ResolvedLink>,       \u002F\u002F keyed by URL as written in post.text\n\u002F\u002F   media: Record\u003Cstring, MediaAsset>,         \u002F\u002F { variant, bytes, width, height, role, data? }\n\u002F\u002F   source: { url, id, appVersion, pinned },   \u002F\u002F upstream status metadata\n\u002F\u002F   warnings: string[],\n\u002F\u002F }\n\nconst link = await xeet.resolveLinks(\"https:\u002F\u002Ft.co\u002FjO01BMGwXr\", { media: false }, host);\n\u002F\u002F link: { meta: LinkMeta, chain: { url, status }[], finalUrl, tags, imageUrl, image?, notes, cached }\n```\n\n[`packages\u002Fxeet\u002Fsrc\u002Fresolve.js`](packages\u002Fxeet\u002Fsrc\u002Fresolve.js#L41) documents the [`Host`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L190) contract (`whatwgHost`, `memoryCache`, `noCache`); failures throw [`ResolveError`](packages\u002Fxeet\u002Fsrc\u002Ftypes.d.ts#L327) ([`resolve.js`](packages\u002Fxeet\u002Fsrc\u002Fresolve.js#L134) · [`xeet-resolve`](crates\u002Fxeet-resolve\u002Fsrc\u002Flib.rs#L335)) with `{ code, status, fields }`.\n\n### Rust & CLI\n\n```rust\nuse xeet_core::render;\n\n\u002F\u002F Result\u003C(Vec\u003Cu8>, model::Report), render::Error> — network-free; core fonts embedded\nlet (png, report) = render::render(&post, &opts)?;\n\u002F\u002F Result\u003C(paint::Pixmap, model::Report), render::Error> — straight-alpha RGBA8\nlet (pixmap, report) = render::render_rgba(&post, &opts)?;\n\u002F\u002F Result\u003Cmodel::Report, render::Error>\nlet report = render::explain(&post, &opts)?;\n\u002F\u002F Result\u003Cbool, render::Error>\nlet can_expand = render::has_show_more(&post, &opts)?;\n\u002F\u002F Result\u003C(DisplayList, model::Report), render::Error> — every box, before rasterizing\nlet (list, report) = render::display_list(&post, &opts)?;\n```\n\nSee [`render.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frender.rs#L162), [`model.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fmodel.rs#L16), [`display.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fdisplay.rs#L153), and [`paint\u002Fmod.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fpaint\u002Fmod.rs#L51) for the Rust types. The resolver ([`xeet-resolve`](crates\u002Fxeet-resolve\u002Fsrc\u002Flib.rs#L449)) exposes the same [`Resolved`](crates\u002Fxeet-resolve\u002Fsrc\u002Flib.rs#L322) \u002F [`ResolvedLink`](crates\u002Fxeet-resolve\u002Fsrc\u002Flib.rs#L263) types over injected traits (`Fetch`, `Lookup`, `Cache`, `Clock`), with [`xeet-resolve-net`](crates\u002Fxeet-resolve-net\u002Fsrc\u002Flib.rs) as the default `ureq` + `rustls` host:\n\n```rust\n\u002F\u002F Result\u003Cxeet_resolve::Resolved, xeet_resolve::Error>\nlet resolved = xeet_resolve::resolve(input, options, &fetch, Some(&lookup), Some(&cache), Some(&clock)).await?;\n```\n\n```sh\nnpm i -g @xeet\u002Fcli               # or: cargo install --git https:\u002F\u002Fgithub.com\u002Frauchg\u002Fxeet xeet-cli\n\nxeet render post.json --surface web-detail --width 390 --theme dark --dpr 3 -o post.png   # writes PNG (-o - for stdout)\nxeet explain post.json --compact | jq .size                                               # prints Report JSON to stdout\nxeet sheet post.json --widths 320,390,600 --themes light,dark -o sheet.png                # writes contact-sheet PNG\nxeet resolve https:\u002F\u002Fx.com\u002FNASA\u002Fstatus\u002F2119833829389041896 --media | xeet render - -o nasa.png # Resolved JSON → PNG\nxeet-render serve --stdio        # JSONL server: { id, op: \"render\" | \"explain\" | \"info\", ... }\n```\n\nCLI exit codes ([`commands\u002Fmod.rs`](crates\u002Fxeet-cli\u002Fsrc\u002Fcommands\u002Fmod.rs#L11)): `0` success, `2` bad usage, `3` invalid input or over limit, `4` render stage failure, `5` file\u002Fnetwork I\u002FO error.\n\n## How it imitates Chrome\n\n**1️⃣ Rules.** [`SPEC.md`](SPEC.md) and\n[`crates\u002Fxeet-core\u002Fsrc\u002Frules\u002F`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002F) mirror the JS X\nactually ships ([`rules\u002Fx-web.json`](crates\u002Fxeet-core\u002Frules\u002Fx-web.json)). The\nruleset is `x-web@55591fe0`, and each entry says whether it was read out of X's\nshipped client code, measured across 270 captured public payloads, or is still a\nprior. Entity extraction (twitter-text's rules, reimplemented and held to its\nown 2,119-case suite), the UTF-16 `Show more` cut and the `display_text_range`\nthat decides it — landing mid-emoji moves the boundary to the next code point —\nattachment precedence, and the depth-2 nested quote: a self-quote at either hop\nis rejected, and so is a preview that would draw two attachments.\n\n**2️⃣ Text & shaping.** [`inline.rs`](crates\u002Fxeet-core\u002Fsrc\u002Finline.rs),\n[`shape.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fshape.rs),\n[`fonts.rs`](crates\u002Fxeet-core\u002Fsrc\u002Ffonts.rs),\n[`script.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fscript.rs) and\n[`linebreak.rs`](crates\u002Fxeet-core\u002Fsrc\u002Flinebreak.rs) reproduce Blink plus\nHarfBuzz to 0 line-break mismatches: `harfrust` shapes each run and converts its\nadvances the way Blink does, in 16.16 fixed point; Blink's `ScriptRunIterator`\ndecides the runs, so a bracket that changes script takes the next script's run\nand loses the kerning; a per-character CSS `unicode-range` walk picks the face\nacross X's 28 Chirp woff2 subsets, Arial, Apple Color Emoji and the\nsymbol\u002Fmath\u002FHiragino fallbacks. Breaking is UAX #14 (`icu_segmenter`) with\nBlink's `1\u002F64 px` fit arithmetic — a line may end 1\u002F64 px into a hanging space —\nand bidi is UAX #9 (`unicode-bidi`) with rule L1 putting trailing whitespace back\nat the paragraph level.\n\n**3️⃣ Frame & attachments.** [`frame\u002F`](crates\u002Fxeet-core\u002Fsrc\u002Fframe\u002F) and\n[`cards\u002F`](crates\u002Fxeet-core\u002Fsrc\u002Fcards\u002F) are CSS flexbox as Blink lays it out:\nthe two-row header with truncated name and handle, the 40 px avatar (a `10%`\nradius on a business account's square), action counts that abbreviate the way X\nabbreviates them, CSS `superellipse(2)` squircle media corners, the image\ncarousel X draws now (one card per image, up to 20, cells clipped at the\nright edge as the \"there is more\" hint), video duration and `\"Post video\"`\nattribution pills, `summary_large_image` and `summary` link cards, one- and\ntwo-level quote cards, and polls.\n\n**4️⃣ Analytic paint & color emoji.**\n[`paint\u002Fcoverage.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fpaint\u002Fcoverage.rs) replaces\n`tiny-skia`'s path AA — four sub-samples per row, 16 coverage levels — with exact\nhorizontal span overlap over 64 vertical sub-rows per pixel, which lands within\n`≤ 4\u002F255` of analytic area on a circle. Glyphs are unhinted\n[`skrifa`](crates\u002Fxeet-core\u002Fsrc\u002Fpaint\u002Fglyph.rs) outlines quantized to Skia's\n`1\u002F4 px` subpixel grid, with the baseline snapped to a whole CSS pixel the way\nBlink snaps it. Images scale over a premultiplied mipmap pyramid\n([`images.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fpaint\u002Fimages.rs)). Emoji are Apple `sbix`\nPNG strikes ([`emoji.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fpaint\u002Femoji.rs)): `dupe` and\n`flip` records are followed, `flip` toggling a horizontal mirror, the em box is\nplaced at CoreText's `[-0.875em .. +0.125em]` around the alphabetic baseline, and\nthe strike is resampled with a two-pass premultiplied tent.\n\n## What it handles\n\nThese are the details that make a preview look like X rather than almost like\nX. Each item links to the code that implements it and, where there is one, the\ntest that keeps it working.\n\n**Text and layout**\n\n- Blink's line-fitting arithmetic, including its `1\u002F64 px` slack, so a line can\n  end 1\u002F64 px into a hanging space, and that space survives in front of a clamped\n  `…`. ([`inline.rs`](crates\u002Fxeet-core\u002Fsrc\u002Finline.rs),\n  [`frame\u002Fmod.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fframe\u002Fmod.rs), test\n  [`a_trailing_space_stays_in_front_of_the_ellipsis`](crates\u002Fxeet-core\u002Fsrc\u002Fframe\u002Fmod.rs#L1515))\n- Right-to-left text: UAX #9 bidi, with rule L1 resetting trailing spaces, and\n  script-aware kerning for Arabic and Hebrew.\n  ([`inline.rs`](crates\u002Fxeet-core\u002Fsrc\u002Finline.rs),\n  [`script.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fscript.rs), [gallery](#gallery))\n- Engagement counts in `tabular-nums` (`tnum`) and abbreviated the way X\n  abbreviates them. ([`shape.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fshape.rs),\n  [`frame\u002Fnumbers.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fframe\u002Fnumbers.rs))\n\n**Emoji and symbols**\n\n- ZWJ, skin-tone, keycap and tag-flag sequences of any length draw as one glyph.\n  The right-facing `🏃‍♂️‍➡️` comes from Apple `sbix` `flip` records, mirrored\n  horizontally. ([`paint\u002Femoji.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fpaint\u002Femoji.rs),\n  [gallery](#gallery))\n- VS15 and VS16 choose between text and emoji presentation: `©` in Chirp or\n  Arial, `©️` in Apple Color Emoji.\n  ([`fonts.rs`](crates\u002Fxeet-core\u002Fsrc\u002Ffonts.rs))\n- The hairline `✓`, ballot boxes, block arrows and chess pieces come from STIX\n  Two Math rather than the brush-stroke Noto Sans Symbols 2, matching Chrome.\n  ([`tools\u002Fsync-upstream.mjs`](tools\u002Fsync-upstream.mjs), [gallery](#gallery))\n- Kaomoji built from Box Drawing (`┻┳|`, `╯`) and halfwidth katakana (`ﾉ`)\n  fall back to Hiragino Sans, while Simplified\u002FTraditional Chinese (`线`, `亿`,\n  `视`) and Korean Hangul (`한글`) fall through to SIL OFL Noto Sans SC and KR\n  (with `XEET_FONT_DIR` runtime overrides and visible `.notdef` tofu boxes for\n  unbundled scripts).\n  ([`iconic_posts.rs`](crates\u002Fxeet-core\u002Ftests\u002Ficonic_posts.rs),\n  [gallery](#gallery))\n\n**X's client rules**\n\n- Weighted length as the composer counts it: URLs cost 23, out-of-band\n  `attachment_url` quotes cost 0, and any emoji sequence costs 2.\n  ([`length.rs`](crates\u002Fxeet-text\u002Fsrc\u002Flength.rs),\n  [`emoji.rs`](crates\u002Fxeet-text\u002Fsrc\u002Femoji.rs),\n  [`rules\u002Fmod.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Fmod.rs), tests\n  [`weighted_emoji_tweets`](crates\u002Fxeet-text\u002Ftests\u002Fconformance.rs#L609) and\n  [`weighted_length_counts_urls_as_23_and_cjk_as_2`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Ftextport.rs#L96))\n- \"Show more\" cuts measured in UTF-16 units, with recovery when\n  `display_text_range` lands in the middle of a surrogate pair.\n  ([`rules\u002Fspec.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Fspec.rs), test\n  [`a_utf16_range_that_bisects_a_surrogate_rounds_up`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Ftests.rs#L269))\n- A trailing status URL becomes a quote, whether it is a `?s=20` share link,\n  `\u002Fi\u002Fstatus\u002F`, `mobile.twitter.com`, or a shortened `t.co` permalink.\n  ([`rules\u002Fmod.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Fmod.rs), tests\n  [`trailing_quote_url_variants_are_hidden`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Ftests.rs#L938)\n  and [`share_sheet_suffixes_still_quote`](crates\u002Fxeet-resolve\u002Fsrc\u002Ftests.rs#L845))\n- Attachment precedence: media, a quote and a poll each win over a link card,\n  only the last link with card metadata gets the card, and a dismissed card\n  (`tombstone:\u002F\u002Fcard`) never falls back to an earlier link. ([`rules\u002Fmod.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Fmod.rs), tests\n  [`media_beats_a_link_card`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Ftests.rs#L343) and\n  [`a_dismissed_card_shows_nothing_and_is_not_inherited`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Ftests.rs#L453))\n- Quotes nested two deep, the way X's `H(outer, q1, q2)` decides them: no\n  preview for a self-quote or when it would draw two attachments, plus the\n  conditional top padding from `p-3 [:first-child+&]:pt-0`.\n  ([`rules\u002Fmod.rs`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Fmod.rs),\n  [`cards\u002Fquote.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fcards\u002Fquote.rs), tests\n  [`quoting_yourself_hides_the_nested_preview`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Ftests.rs#L849)\n  and [`at_most_one_of_the_three_cells_may_render_media`](crates\u002Fxeet-core\u002Fsrc\u002Frules\u002Ftests.rs#L876))\n\n**Cards, media and the frame**\n\n- A `\u002Fstatus\u002F\u003Cid>\u002Fvideo\u002F1` link becomes the post's own video, with the original\n  author credited (`Media.sourceAuthor`) in the duration pill.\n  ([`attach.rs`](crates\u002Fxeet-resolve\u002Fsrc\u002Fattach.rs),\n  [`cards\u002Fmedia.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fcards\u002Fmedia.rs), test\n  [`a_status_video_url_becomes_post_media_not_a_quote`](crates\u002Fxeet-resolve\u002Fsrc\u002Ftests.rs#L1313))\n- Video durations floored and zero-padded like X's formatter.\n  ([`cards\u002Fmedia.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fcards\u002Fmedia.rs), test\n  [`duration_label_matches_the_client_formatter`](crates\u002Fxeet-core\u002Fsrc\u002Fcards\u002Fmedia.rs#L1030))\n- Business accounts get square avatars with `10%` rounding, and their\n  `BusinessLabel` affiliation badges.\n  ([`frame\u002Fmod.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fframe\u002Fmod.rs), test\n  [`quoted_header_wraps_affiliate_badge_for_its_depth`](crates\u002Fxeet-core\u002Fsrc\u002Fcards\u002Fquote.rs#L495))\n- Card credits read `From merriam-webster.com`, with the leading `www.` removed.\n  ([`cards\u002Fcard.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fcards\u002Fcard.rs), test\n  [`merriam_webster_cards_strip_leading_www_from_domain_credit`](crates\u002Fxeet-core\u002Ftests\u002Ficonic_posts.rs#L105))\n- Each quote's timestamp uses its own timezone offset, measured against the\n  outer post's clock. ([`frame\u002Ftime.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fframe\u002Ftime.rs),\n  [`cards\u002Ftime.rs`](crates\u002Fxeet-core\u002Fsrc\u002Fcards\u002Ftime.rs), tests\n  [`offset_changes_the_calendar_day`](crates\u002Fxeet-core\u002Fsrc\u002Fframe\u002Ftime.rs#L373)\n  and [`a_quote_without_a_clock_uses_the_outer_posts_now`](crates\u002Fxeet-core\u002Fsrc\u002Fcards\u002Fquote.rs#L645))\n\n**Resolving links safely**\n\n- `t.co` answers `Twitterbot\u002F1.0` with a `301` but browsers with a `200`\n  interstitial, so xeet crawls as Twitterbot.\n  ([`xeet-resolve\u002Fsrc\u002Flib.rs`](crates\u002Fxeet-resolve\u002Fsrc\u002Flib.rs), test\n  [`a_t_co_link_becomes_the_card_x_shows`](crates\u002Fxeet-resolve\u002Fsrc\u002Ftests.rs#L306))\n- Redirects are followed by hand, up to 10 hops, including\n  `\u003Cmeta http-equiv=\"refresh\">`, and `robots.txt` rules for the Twitterbot group\n  are honored. ([`urlsafety.rs`](crates\u002Fxeet-resolve\u002Fsrc\u002Furlsafety.rs), tests\n  [`a_meta_refresh_redirect_is_followed`](crates\u002Fxeet-resolve\u002Fsrc\u002Ftests.rs#L470)\n  and [`robots_txt_is_honoured`](crates\u002Fxeet-resolve\u002Fsrc\u002Ftests.rs#L403))\n- SSRF protection: private, loopback and cloud-metadata addresses are refused,\n  both as literals and on every DNS hop, including IPv4-mapped, NAT64 and 6to4\n  forms. ([`urlsafety.rs`](crates\u002Fxeet-resolve\u002Fsrc\u002Furlsafety.rs), tests\n  [`refuses_private_addresses`](crates\u002Fxeet-resolve\u002Fsrc\u002Furlsafety.rs#L508) and\n  [`private_destinations_are_refused`](crates\u002Fxeet-resolve\u002Fsrc\u002Ftests.rs#L435))\n- When X's server render includes the same post more than once, the richest copy\n  wins, so `squareAvatar` and affiliation badges aren't lost.\n  ([`post.rs`](crates\u002Fxeet-resolve\u002Fsrc\u002Fpost.rs), test\n  [`a_slim_ssr_copy_does_not_wipe_the_author_metadata`](crates\u002Fxeet-resolve\u002Fsrc\u002Ftests.rs#L1194))\n\n**Build**\n\n- The WASM module is built with thin LTO, because LLVM's fat LTO miscompiles\n  path spans. ([`tools\u002Fship\u002Fbuild-wasm.mjs`](tools\u002Fship\u002Fbuild-wasm.mjs))\n\n## How the tests work\n\nEvery layer is compared against something that is not xeet.\n\n**Text, against Chrome.** [`tools\u002Foracle\u002Ftext-parity.mjs`](tools\u002Foracle\u002Ftext-parity.mjs)\nlays the same strings out in headless Chrome and in xeet — corpus, fuzz, a 17 px\ndetail set, emoji, bidi, math-styled letters, whitespace — and reports 0\nline-break and 0 height mismatches across 13,440 layouts. The committed golden\n([`tests\u002Fgolden\u002Ftext.json`](tests\u002Fgolden\u002Ftext.json), 1,260 layouts of our own\nsynthetic strings) lets CI re-check line boxes with no Chrome and no network\n([`tools\u002Fship\u002Fparity-check.mjs`](tools\u002Fship\u002Fparity-check.mjs)), widths inside\n`4\u002F64 px`.\n\n**Cards, frame, icons, against X's markup.** [`cards-parity.mjs`](tools\u002Foracle\u002Fcards-parity.mjs)\nruns 192\u002F192. [`examples\u002Fframe_parity.rs`](crates\u002Fxeet-core\u002Fexamples\u002Fframe_parity.rs)\ncompares every box against geometry [`replica.mjs`](tools\u002Foracle\u002Freplica.mjs)\ncaptured from X's real markup: 147\u002F147 rows per theme.\n[`iconic-parity.mjs`](tools\u002Foracle\u002Ficonic-parity.mjs) takes the four posts people\nuse to break renderers — `@NASAGoddard`'s space field, `@MerriamWebster`'s emoji\nradio buttons, `@MerriamWebster`'s `┻┳|` brick wall, and `@pizzahut`'s dancing\nfigure — at 24\u002F24.\n\n**End to end, against the captured site.** [`tools\u002Fship\u002Fe2e.mjs`](tools\u002Fship\u002Fe2e.mjs)\nrenders every post embedded in the captured `x.com` pages and compares it with\nChrome rendering that page: 159\u002F159 in [`tests\u002Fgolden\u002Fe2e.json`](tests\u002Fgolden\u002Fe2e.json),\nunder a 0.5% analytic pixel budget where the platform allows it (Linux) and 3% on\nmacOS, where CoreText's stem darkening is a floor no renderer crosses.\n\n**Contracts, text rules, determinism, CI.** `xeet-text` passes all 2,119\n`twitter-text` conformance cases and agrees with the extracted X client code on\n3,029 more ([`crates\u002Fxeet-text\u002Ftests\u002F`](crates\u002Fxeet-text\u002Ftests\u002F)).\n[`check-contract.mjs`](tools\u002Fship\u002Fcheck-contract.mjs) keeps the Rust model, the\nJSON Schema and the MCP tool definitions in one shape;\n[`check-unsafe.mjs`](tools\u002Fship\u002Fcheck-unsafe.mjs) enforces\n`#![forbid(unsafe_code)]`; [`golden-stamp.mjs`](tools\u002Fship\u002Fgolden-stamp.mjs)\nrejects a golden that changed without a new oracle stamp;\n[`determinism.mjs`](tools\u002Fship\u002Fdeterminism.mjs) finds native and WASM SHA-256\nidentical on 24\u002F24 cases, across Linux x64, Linux arm64 and macOS. The suite\ngates every push to `main` in Vercel CI ([`turbo.json`](turbo.json),\n[`tools\u002Fship\u002Fvercel-build.mjs`](tools\u002Fship\u002Fvercel-build.mjs)), while tagged\nreleases verify cross-OS determinism across macOS, Linux, Windows and WASM\nbefore publishing via GitHub OIDC Trusted Publishing\n([`.github\u002Fworkflows\u002Frelease.yml`](.github\u002Fworkflows\u002Frelease.yml)).\n\n## License\n\nThe source code in this repository is licensed under the\n[Apache License 2.0](LICENSE): use it, modify it, and redistribute it, keeping\nthe license and attribution notices.\n\nX's Chirp and the platform reference fonts in `assets\u002Fvendor\u002Ffonts\u002F` remain\nunder their respective upstream terms and are not covered by the Apache-2.0\nlicense above. They are vendored here for CI and parity verification.\nRedistribute public binaries only with fonts you are licensed to ship, or with\nfonts the host machine supplies.\n","xeet 是一个无需浏览器即可将 X（原 Twitter）帖子精准渲染为 PNG 图像的工具。它用安全 Rust 重实现 X 客户端的核心排版逻辑，包括 Blink\u002FHarfBuzz 文本布局、Flexbox 几何计算和 Skia 风格抗锯齿，支持完整 emoji、多语言（CJK\u002FRTL）、数学字体、嵌套引用与“Show more”截断等细节，并保证与 Chrome 渲染像素级一致。提供原生二进制与 WebAssembly 双运行时，离线可用、零依赖、确定性输出。适用于社交媒体内容归档、预览生成、自动化截图及合规性存证等需高保真、高性能、无头渲染的场景。","2026-11-24 04:50:30","CREATED_QUERY"]