Repository navigation
fix(md): render task lists and support right-to-left pages - #811
Merged
Merged
Conversation
Task items written as `- [ ] todo` rendered as literal text. Add a core rule that turns them into disabled checkboxes with the classes the theme already styles. Also place heading anchors and the code copy button with logical CSS properties so right-to-left pages mirror them, and add a `copyLabel` option for the copy button title. Closes voidzero-dev#802
harshbhx
force-pushed
the
fix/802-md-task-lists
branch
from
November 13, 2026 11:50
05f7d85 to
d92a6f3
Compare
This was referenced Nov 13, 2026
Brooooooklyn
added a commit
that referenced
this pull request
Nov 13, 2026
…ont (#819) `packages/md/test/integration/theme-layout.test.ts` fails on `main` since #811, in the `test (ubuntu-latest, 1/2)` job: ``` positions heading anchors and copy buttons in ltr expected 44.75 to be ≤ 40 positions heading anchors and copy buttons in rtl expected 1235.25 to be ≥ 1240 ``` ## Cause ``` before: [ -0.87em ][ "#" ][0.23em ] float at the heading start └ ends inside the text when "#" is wider than 0.64em after: [ "#" ][0.23em ]|heading text end edge pinned to the heading start ``` The anchor floated with a fixed negative margin, so whether it covered the heading text depended on how wide the font draws `#`. The Linux runner's font draws it wider, so the float pushed the text over by 4.75 px. This is a real layout issue, not only a test issue. ## Fix - `.void-md h1`–`h6`: `position: relative`. - `.header-anchor`: `position: absolute; inset-inline-end: 100%` instead of `float: inline-start` + `margin-inline-start: -0.87em`. It still mirrors on right-to-left pages. - The layout test widens the `#` with `letter-spacing`, so it fails with the old rule on any machine, not only on Linux. ## Verification - With the old CSS, the updated test fails locally the same way as CI (`51.625 ≤ 40`, `1228.375 ≥ 1240`); with the fix it passes. - `vp test run packages/md`: 14 files, 122 tests passed. - `vp lint`, `vp run --filter ./packages/md typecheck`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Brooooooklyn
added a commit
that referenced
this pull request
Nov 13, 2026
…cy to KV (#814) Since 1.8.0 the proxy asked the API for each project's AI logging policy on every AI call, and the API refused unless PLATFORM_AUTH_DATABASE_UNCACHED was set. Hosted Void Cloud never sets it, so every hosted AI call failed with 503 ai_logging_policy_unavailable. Now the API and the installer write the policy to ROUTING KV key `ai-logging:<projectId>`, and the proxy reads it from there. ## How AI logging works **The setting.** Each project gets one AI Gateway logging mode: | Mode | What AI Gateway stores | |---|---| | `inherit` | Whatever the gateway is set to; Void sends nothing (same as 1.7.0) | | `off` | No log entry | | `metadata` | A log entry without the request or response bodies | | `full` | A log entry with the bodies | **Which mode wins:** the project's own setting, then its plan's default, then the gateway. An account on a plan that isn't in the catalog uses the default plan's setting. ### Data flow ``` operator / CLI / dashboard project ai-logging · plans set · user plan · transfer · create · delete │ ▼ ┌──────────────────────┐ lock project row, read inputs ┌──────────────┐ │ API │ ──────── through a write ─────────▶ │ Postgres │ saved settings │ works out the mode │◀─────────────────────────────────── │ │ (the truth) └──────────┬───────────┘ └──────────────┘ │ write under the lock (retries a 429 after 1/2/4 s) ▼ ROUTING KV ai-logging:<projectId> = off | metadata | full (no key = inherit) ▲ metadata {mode, at} │ read on every AI call, 30 s cache ┌──────────┴───────────┐ │ proxy │ ──▶ AI Gateway headers for /ai/run, /ai/toMarkdown, /ai/provider └──────────────────────┘ ``` The proxy no longer calls the API. That call was the 503 that broke AI on hosted Void Cloud. ### Who writes the key | Event | What happens | |---|---| | Operator sets a project mode | Stricter change (e.g. `full` → `off`): one transaction, rolled back if KV fails. Looser change or `inherit`: saved first, then published. | | Plan default changes | Published 100 projects per call. `plans sync` continues, and the CLI keeps syncing until done. | | User's plan changes | One page per call; running the same change again continues it | | Project create / transfer / delete | Key written inside the create; republished on transfer; removed only after the row is gone | | Install / upgrade / repair | The installer copies every saved setting to KV, before and after the Worker upload | | Every hour | The sweep repairs keys that differ from Postgres (at most 400 KV operations per run) | ### Timing KV reads are cached for 30 s at each Cloudflare location, so a change can take a short while to reach every location. After a change, the CLI prints "expected by HH:MM:SS (normally within 2 minutes)". ### Readback `void platform project show` and `project ai-logging` report a state: ``` applied KV matches and the settle time has passed pending just published; some locations may still use the old value pending_plan_publish a plan or user-plan publish has not reached this project yet drift KV differs from the saved setting (the hourly sweep fixes it) unknown KV could not be read ``` ### When something fails, the proxy refuses instead of guessing - KV read error: `503 ai_logging_policy_unavailable`, with `Retry-After` - Unknown value in KV: `503 ai_logging_policy_invalid` (the value itself is never logged) - Publish failure on a change: `ai_logging_publish_failed` (nothing changed) or `ai_logging_publish_pending` (saved, KV catches up) ### Older proxies Proxies still on 1.8.x keep calling `GET /internal/ai-logging/:id`. That route still exists and now answers from the same KV key, so they work during the upgrade. ## Changes Shared (`@void/platform/ai-logging`) - Key names, value and metadata shape, parsers, resolver and the 30 s read cache time, used by the API, the installer and the proxy. Proxy - Reads the key (cacheTtl 30) in /ai/run, /ai/provider and /ai/toMarkdown, after body validation. Missing key: inherit (no logging option, as in 1.7.0). off / metadata / full: the 1.8.0 gateway mapping. KV error: 503 ai_logging_policy_unavailable. Bad value: 503 ai_logging_policy_invalid. Caller-supplied logging keys are still stripped. API - publishProjectAiLogging locks the project row, reads every input through a write statement (cached Hyperdrive reads never feed a publish), and writes KV before the lock is released. - The operator POST orders the write by direction: a tighten writes in the same transaction; a loosen or inherit commits first and publishes in a second locked step. Errors: ai_logging_publish_failed / _pending. - Plan defaults in platform_settings 'plans:ai-logging', published in pages of 100. A user plan change publishes one page per call; transfer, create and delete keep the key in step. - An unfinished plan publish follows its accounts through a catalog change: a removed plan's scope moves to its replacement, and a run that covered unknown plans also covers plans added to the catalog. - Readback returns saved, plan, effective, source, published and a state: applied, pending, pending_plan_publish, drift or unknown. - An hourly sweep repairs drifted keys within a 400 KV operation budget. - The internal route 1.8.x proxies call is kept and answers from KV. Installer and CLI - Every install, upgrade and repair copies each project's setting from Postgres to KV, before and after the Worker upload, under the same row locks as the API. - `void platform project ai-logging` and `project show` print the source, effective mode and state; plan files accept `aiLogging`. Docs - CLI reference, admin guides, upgrade note, design doc 0094, operations notes for the hosted rollout. Refs #793. Replaces the stack #814–#817 (now one PR, so the proxy switch and the KV writers land together). ## Verification - Full suite (`vp test run`) before the test cleanup: 804 files, 17,022 tests passed, 35 skipped. After it: `vp run check`, `vp lint`, the touched test files, and CI. - The two PostgreSQL-only lock-wait tests (`VOID_TEST_DATABASE_URL`) run in CI. - `packages/md/test/integration/theme-layout.test.ts` also fails on `main` (from #811); fixed in #819. Merge #819 first, then update this branch from `main`. - Not run: live checks A/B, done by hand on a scratch Cloudflare account; see design doc 0094. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #802
Summary
Covers all four items of #802 for
@void/md: task lists render as checkboxes, heading anchors and the code copy button mirror correctly on right-to-left pages, and the copy button title can be translated with a newcopyLabeloption.Problem
prose.cssstyles.contains-task-listand.task-list-item, but nothing incompile.tsproduces them, so- [ ] itemrenders as the literal text[ ] item..header-anchorinpackages/md/src/theme/prose.cssusesfloat: left,margin-leftandpadding-right, so in adir="rtl"page the#sticks out past the left edge..copyinpackages/md/src/theme/code.cssusesright: 0.5em.title="Copy Code"inpackages/md/src/plugins/pre-wrapper.tsis fixed in English.Solution
packages/md/src/plugins/task-lists.ts, registered incompile.ts. For a list item whose first paragraph starts with[ ],[x]or[X]followed by text, it removes the marker, prepends a disabled checkbox (checkedforx), addstask-list-itemto theliandcontains-task-listto its list. Look-alikes ([ ]with nothing after it,[x]no space, a marker mid-line, outside a list) are left alone. No new dependency; the class names match the existing CSS.float: inline-start,margin-inline-start,padding-inline-end. Left-to-right pages render the same as before.inset-inline-endinstead ofright. Same for left-to-right.copyLabeloption onvoidMarkdown()andcompile(), defaultCopy Code, HTML-escaped before it goes into thetitleattribute.Changes
packages/md/src/plugins/task-lists.tspackages/md/src/compile.tscopyLabeloption, pass it to the pre-wrapperpackages/md/src/plugin.tscopyLabelinMarkdownOptions, passed tocompile()packages/md/src/plugins/pre-wrapper.tscopyLabel(defaultCopy Code), escapedpackages/md/src/theme/prose.css.header-anchorpackages/md/src/theme/code.cssinset-inline-endfor.copydocs/guide/pages-routing/markdown.mdcopyLabelin Plugin Optionspackages/md/test/unit/plugins.test.tspackages/md/test/unit/theme-css.test.tsBefore / After
Input
- [ ] todo/- [x] done:Before:
<ul><li>[ ] todo</li><li>[x] done</li></ul>After:
Copy label:
How to test
.mdpage in a playground using@void/mdand check the checkboxes.dir="rtl"on a page with headings and code blocks: the heading#should sit at the right of the heading and the copy button at the left end of the code block.copyLabelinvoidMarkdown()and hover the copy button.Testing done
vp check, both integration shards) passed on my fork: https://github.com/harshbhx/void/actions/runs/43419615669. Earlier fork runs caught two mistakes in my own work (the list class was added once per item; two files not formatted), both fixedNotes for reviewers
disabled, like GitHub's rendering, since pages are static HTML.copyLabelis read when the markdown compiler is first created, likeshiki.