Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
c2ec499
chore(deps): upgrade Fumadocs to 16.17.9
nickvigilante Nov 2, 2026
cafd18d
chore: drop collapsed-sidebar CSS and refresh version notes after the…
nickvigilante Nov 2, 2026
18939cf
ci(.github): empty the axe allowlist
nickvigilante Nov 2, 2026
560d004
fix(docs-transforms): keep gate text and tags out of search records
nickvigilante Nov 2, 2026
f0df0ad
Merge origin/main into vigilante/fumadocs-16-17-upgrade
nickvigilante Nov 5, 2026
efc1bb3
chore: merge main and regenerate pnpm-lock.yaml
coder[bot] Nov 16, 2026
654403f
chore: merge main and regenerate pnpm-lock.yaml
nickvigilante Nov 17, 2026
4a90ee1
fix(docs-transforms): blank a hidden Experimental body after its nest…
nickvigilante Nov 17, 2026
b55d87c
fix(docs-transforms): refuse to default replaceSource across fumadocs…
nickvigilante Nov 17, 2026
aafd24e
fix(docs): normalise DOCS_BASE_PATH before the MDX pipeline gets it
nickvigilante Nov 17, 2026
7d71f40
fix(docs-next): show Search failed when the search index cannot be fe…
nickvigilante Nov 17, 2026
bcdf300
fix(docs-next): drop a table record's delimiter row by position
nickvigilante Nov 17, 2026
8e74daa
docs: name fumadocs-ui 16.17.9 in the fork notes it was checked against
nickvigilante Nov 17, 2026
d732311
refactor(docs-transforms): build both callout markers from one alert …
nickvigilante Nov 17, 2026
540a935
test: compile the e2e pipelines with their own package's replaceSource
nickvigilante Nov 17, 2026
b9cb337
fix(docs-transforms): require this package's own remarkHeading unless…
nickvigilante Nov 18, 2026
d09b18b
Merge remote-tracking branch 'origin/main' into vigilante/fumadocs-16…
nickvigilante Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions .github/a11y-allowlist.json
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
[
"tracked-search-listbox axe dark /#search aria-required-children",
"tracked-search-listbox axe dark /#search scrollable-region-focusable",
"tracked-search-listbox axe light /#search aria-required-children",
"tracked-search-listbox axe light /#search scrollable-region-focusable",
"tracked-search-listbox axe mobile-dark /#search aria-required-children",
"tracked-search-listbox axe mobile-dark /#search scrollable-region-focusable",
"tracked-search-listbox axe mobile-light /#search aria-required-children",
"tracked-search-listbox axe mobile-light /#search scrollable-region-focusable",
"tracked-search-listbox axe more-dark /#search aria-required-children",
"tracked-search-listbox axe more-dark /#search scrollable-region-focusable",
"tracked-search-listbox axe more-light /#search aria-required-children",
"tracked-search-listbox axe more-light /#search scrollable-region-focusable"
]
[]
6 changes: 3 additions & 3 deletions apps/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ That is coder.com's own convention for Markdown-for-agents copies, so a reader w
`<version base>` is the site's base path plus the version's own prefix: `/docs/llms.txt` for the mainline, `/docs/v2.36/llms.txt` for v2.36.
The version prefix comes first, so the router resolves the version from the leading segment and reads the file from that version's own archive prefix.

The twin is the page's post-rendered Markdown (`postprocess: { includeProcessedMarkdown: true }` on each docs collection), under a `# <title>` heading.
The twin is the page's processed Markdown, sliced from the authored source (`postprocess: { includeProcessedMarkdown: true }` on each docs collection), under a `# <title>` heading.

No route can serve a twin at its page's URL: `app/llms.mdx/[...slug]/route.ts` and the page catch-all resolve the same paths, and a route segment cannot match on a file extension.
So the routes generate the twins into `llms.mdx/`, the staging directory, and every build ends by relocating them — `relocateMarkdownTwins` in `scripts/archive-layout-helpers.mjs`, run by the stitch, by the offline build, and by the monolithic export the parity check compares against; `layoutPlan` maps the same destinations, so `_publish.json` records the keys the router reads.
Expand All @@ -73,10 +73,10 @@ Both are plain text, never HTML, always with `X-Content-Type-Options: nosniff`:
That section also records what these outputs do **not** do: the snapshot predates the sanitize stage, so a twin carries the corpus's raw HTML as authored.
`scripts/archive-layout-helpers.mjs` pins the pair for the published archive, and `vercel.json` pins it for a Vercel deployment of the export (every `.md` path, since a twin is the only one either export holds).

Every URL inside a twin carries the site's base path, which the docs collection passes to `processedMarkdownOptions` in `source.config.ts`.
Every URL inside a twin carries the site's base path, which the docs collection passes to `createCoderMdxOptions` in `source.config.ts`.
Next applies its own `basePath` to the links a page renders; this snapshot never passes through that, so without it every link in every twin would point outside the deployment.
The one exception is a link written inside a raw `<details>` block, whose body reaches the snapshot as text rather than as a link node: it keeps the form the corpus wrote (2 of 5,818 links in the current corpus).
`processedMarkdownOptions` also turns off Fumadocs' `[#id]` suffix on twin headings, which is Fumadocs-only syntax that plain-Markdown readers see as noise.
`processedMarkdownOptions` turns off Fumadocs' `[#id]` suffix on twin headings, which is Fumadocs-only syntax that plain-Markdown readers see as noise.
That is the same remark-phase boundary the threat-model note below describes.

Each page also carries `<link rel="alternate" type="text/markdown">` to its twin, and shows fumadocs' **Copy Markdown** button and our **Open** dropdown to the right of the description, in the same row (they drop beneath it on a narrow viewport), both pointed at the same URL.
Expand Down
13 changes: 4 additions & 9 deletions apps/docs/scripts/a11y-axe.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,16 @@ const settle = (page) =>
.every((a) => a.effect?.getTiming().iterations === Infinity || a.playState === "finished"),
);

// Opens the search dialog and selects a result whose text carries a match highlight.
// Opens the search dialog with results listed; the match highlight is a CSS highlight axe cannot see.
async function openSearchWithMatch(page) {
await page.keyboard.press("Control+k");
const input = page.locator('[role="dialog"] input');
await input.waitFor();
await settle(page);
await input.fill(SEARCH_QUERY);
const options = page.locator('[role="option"]');
await options.first().waitFor();
const selected = page.locator('[role="option"][aria-selected="true"]');
for (let i = 0, n = await options.count(); i < n; i++) {
if ((await selected.locator(".text-fd-primary").count()) > 0) return settle(page);
await page.keyboard.press("ArrowDown");
}
throw new Error(`No search result for "${SEARCH_QUERY}" has a match highlight`);
await page.locator('[role="option"]').first().waitFor();
await page.locator('[role="option"][aria-selected="true"]').waitFor();
return settle(page);
}

async function openSettings(page) {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/scripts/single-version.e2e.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ async function assertRoundTrip(out, { id, root }) {
// deployment, not the origin root. Next applies its own basePath to the
// links a PAGE renders; this markdown snapshot is taken in the remark phase
// and never passes through that, so the collection hands the base path to
// `processedMarkdownOptions` instead. Without it every link here 404s.
// `createCoderMdxOptions` instead. Without it every link here 404s.
const full = await readFile(path.join(out, "beta-docs/v0.1/llms-full.txt"), "utf8");
for (const [label, body] of [
["the twin", twin],
Expand Down
15 changes: 6 additions & 9 deletions apps/docs/source.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
createCoderMdxOptions,
processedMarkdownOptions,
} from "@coder/docs-transforms/mdx-config";
import { replaceSource } from "fumadocs-core/mdx-plugins/stringifier";
import { applyMdxPreset, defineConfig, defineDocs } from "fumadocs-mdx/config";
import imageSizes from "./.generated/image-sizes.json" with { type: "json" };
import releaseScheduleJson from "./.generated/release-schedule.json" with { type: "json" };
Expand Down Expand Up @@ -39,6 +40,8 @@ const coderMdxOptionsFor = (version: DocVersion | undefined) =>
renderContext: STATIC_DOCS_RENDER_CONTEXT,
linkPrefix: versionLinkPrefix(version),
imageSizes,
basePath: normalizeBasePath(process.env.DOCS_BASE_PATH),
replaceSource,
releaseSchedule,
releaseScheduleUrl,
});
Expand Down Expand Up @@ -67,16 +70,10 @@ const versionDocs = (version: DocVersion | undefined) =>
// Keep each page's post-rendered Markdown (`page.data.getText`), which
// the routes under app/llms.mdx/ emit as that page's Markdown twin and
// llms-full.txt concatenates. Without it those routes have nothing to
// serve and fail the build rather than shipping empty files.
//
// The base path has to be passed in: Next applies its own `basePath` to
// the links a PAGE renders, but this snapshot is taken in the remark
// phase and never passes through that, so without it every link in
// every twin would point outside the deployment.
// serve and fail the build rather than shipping empty files. The base
// path reaches the twins through `createCoderMdxOptions({ basePath })`.
postprocess: {
includeProcessedMarkdown: processedMarkdownOptions({
basePath: process.env.DOCS_BASE_PATH,
}),
includeProcessedMarkdown: processedMarkdownOptions(),
},
},
});
Expand Down
2 changes: 2 additions & 0 deletions apps/offlinedocs/source.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { STATIC_DOCS_RENDER_CONTEXT, parseReleaseSchedule } from "@coder/docs-config";
import { coderPageSchema, createCoderMdxOptions } from "@coder/docs-transforms/mdx-config";
import { replaceSource } from "fumadocs-core/mdx-plugins/stringifier";
import { defineConfig, defineDocs } from "fumadocs-mdx/config";
import imageSizes from "./.generated/image-sizes.json" with { type: "json" };
import releaseScheduleJson from "./.generated/release-schedule.json" with { type: "json" };
Expand All @@ -26,5 +27,6 @@ export default defineConfig({
renderContext: STATIC_DOCS_RENDER_CONTEXT,
imageSizes,
releaseSchedule,
replaceSource,
}),
});
5 changes: 3 additions & 2 deletions packages/docs-build/src/sync-includes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { tmpdir } from "node:os";
import path from "node:path";
import { afterEach, beforeEach, test } from "node:test";
import type { DocSource } from "@coder/docs-config";
import { coderMdxOptions } from "@coder/docs-transforms/mdx-config";
import { createCoderMdxOptions } from "@coder/docs-transforms/mdx-config";
import { createProcessor } from "@mdx-js/mdx";
import { remarkLLMs } from "fumadocs-core/mdx-plugins/remark-llms";
import { replaceSource } from "fumadocs-core/mdx-plugins/stringifier";
import { applyMdxPreset } from "fumadocs-mdx/config";
import { DocSyncError, syncDocSource } from "./sync.js";

Expand Down Expand Up @@ -231,7 +232,7 @@ test("a data-feature marker inside a fragment is validated like the page's own",
// The string fumadocs-mdx keeps as `getText("processed")`: the body of a
// page's Markdown twin and of its section in llms-full.txt.
async function processedSnapshot(md: string): Promise<string> {
const resolved = await applyMdxPreset(coderMdxOptions)("bundler");
const resolved = await applyMdxPreset(createCoderMdxOptions({ replaceSource }))("bundler");
const processor = createProcessor({
...resolved,
remarkPlugins: [...(resolved.remarkPlugins ?? []), [remarkLLMs, { _data: true }]],
Expand Down
14 changes: 12 additions & 2 deletions packages/docs-next/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ All building blocks take a `source`: the object returned by Fumadocs' `loader()`
A page's twin is served at the page's own URL with `.md` in place of the trailing slash — `markdownTwinUrl` — and a version root's at `index.md`.
The routes cannot generate it there, because a route segment cannot match on a file extension and the page catch-all resolves the same paths, so they write `MARKDOWN_DIR/<markdownTwinSlug>` (the extension is also what lets a static export write a twin for a page that also has children) and the consuming app's build relocates the files.
Requires `postprocess: { includeProcessedMarkdown: true }` on the app's docs collection; without it the routes throw and name the option.
A twin is the page's compiled tree stringified, so it carries the pipeline's own MDX component tags verbatim (a premium block reaches a consumer as `<PremiumNote>…</PremiumNote>`), which keeps the labels those components carry rather than dropping them.
A twin is the page's authored Markdown with the pipeline's source edits applied, so each gate marker is replaced by the MDX component tag the page compiles to (a premium block reaches a consumer as `<PremiumNote>…</PremiumNote>`), which keeps the labels those components carry rather than dropping them.
- `PageHeader({ description?, markdownUrl, options? })` is the row under the title that both page factories render: the description on the left and `PageActions` on the right, wrapping on a narrow viewport so the body starts higher than with a row of its own.
- `PageActions({ markdownUrl, options?, className? })` is that row's actions: fumadocs' Copy Markdown button and `ViewOptions`, the "Open in ..." dropdown.
Both factories take `pageActions`: `false` drops the row, `{ viewOptions: false }` keeps Copy Markdown and drops the Open dropdown (an air-gapped export, where its links to internet assistants are useless).
Expand Down Expand Up @@ -237,11 +237,21 @@ These stay in the consumer app; this package deliberately does not provide them:

```ts
import { coderPageSchema, createCoderMdxOptions } from "@coder/docs-transforms/mdx-config";
import { replaceSource } from "fumadocs-core/mdx-plugins/stringifier";

export const docs = defineDocs({ dir: "content/docs", docs: { schema: coderPageSchema } });
export default defineConfig({ mdxOptions: createCoderMdxOptions({ renderContext }) });
export default defineConfig({
mdxOptions: createCoderMdxOptions({
renderContext,
basePath: process.env.DOCS_BASE_PATH,
replaceSource,
}),
});
```

Pass `replaceSource` from the app's own `fumadocs-core`: the pipeline edits the Markdown twins and search records through it, and throws at build time when `fumadocs-mdx` runs against another fumadocs-core copy and none was passed, because that copy would silently drop the edits that keep hidden Experimental text out of search.
Pass `basePath` (normalized, as `normalizeBasePath` returns it) when the site is served under a base path, so the links in each Markdown twin carry it.

- The `fumadocs-mdx` generated source (the `.source` output) and a `src/lib/source.ts` that calls `loader()`, for example:

```tsx
Expand Down
5 changes: 3 additions & 2 deletions packages/docs-next/src/classic-anchors.e2e.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import { afterEach, beforeEach, test } from "node:test";
import { normalizeStepHeadings } from "@coder/docs-transforms";
import { coderMdxOptions } from "@coder/docs-transforms/mdx-config";
import { createCoderMdxOptions } from "@coder/docs-transforms/mdx-config";
import { getMDXComponents } from "@coder/docs-ui";
import { createProcessor, run } from "@mdx-js/mdx";
import { replaceSource } from "fumadocs-core/mdx-plugins/stringifier";
import { applyMdxPreset } from "fumadocs-mdx/config";
import { act } from "react";
import { type Root, createRoot } from "react-dom/client";
Expand Down Expand Up @@ -69,7 +70,7 @@ afterEach(async () => {
async function renderPage(name: keyof typeof CLASSIC_IDS, hash = "") {
window.history.replaceState(null, "", `/${hash}`);
const md = normalizeStepHeadings(await fixture(name));
const resolved = await applyMdxPreset(coderMdxOptions)("bundler");
const resolved = await applyMdxPreset(createCoderMdxOptions({ replaceSource }))("bundler");
const processor = createProcessor({ ...resolved, format: "md", outputFormat: "function-body" });
const file = await processor.process({ value: md, path: name });
const { default: Content } = await run(String(file), { ...runtime, baseUrl: import.meta.url });
Expand Down
3 changes: 1 addition & 2 deletions packages/docs-next/src/hybrid-search.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async function corpusIndex(): Promise<string> {
return await (await route.GET()).text();
}

test("the hybrid dialog renders corpus-shaped hits as text and still highlights the match", async (t) => {
test("the hybrid dialog renders corpus-shaped hits as text", async (t) => {
serve({ "/api/search": await corpusIndex() });
const warn = console.warn;
console.warn = () => {};
Expand Down Expand Up @@ -134,7 +134,6 @@ test("the hybrid dialog renders corpus-shaped hits as text and still highlights
CORPUS_PARAGRAPHS.length * 2,
"expected a page and a text hit per paragraph",
);
assert.ok(dialog?.querySelector("span.text-fd-primary"), "expected highlighted hits");
assert.equal(dialog?.querySelector(FORBIDDEN_ELEMENTS), null);
assert.equal(document.head.querySelector("meta[http-equiv]"), null);
});
17 changes: 9 additions & 8 deletions packages/docs-next/src/hybrid-search.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import type { SearchClient } from "fumadocs-core/search/client";
import { useDocsSearch } from "fumadocs-core/search/client";
import { experimental_useSearch } from "fumadocs-core/search/client";
import { staticClient } from "fumadocs-core/search/client/orama-static";
import {
SearchDialog,
Expand All @@ -13,8 +13,8 @@ import {
SearchDialogOverlay,
} from "fumadocs-ui/components/dialog/search";
import type { SharedProps } from "fumadocs-ui/contexts/search";
import { type ComponentProps, useEffect, useMemo, useState } from "react";
import { SearchResultItem } from "./search-markdown.js";
import { useCallback, useEffect, useMemo, useState } from "react";
import { SearchResultItem, renderSearchTable } from "./search-markdown.js";
import {
type SemanticIndex,
type SemanticIndexMeta,
Expand Down Expand Up @@ -83,7 +83,7 @@ export function hybridSearchClient(
};
}

function renderResult(props: ComponentProps<typeof SearchResultItem>) {
function renderResult(props: Parameters<typeof SearchResultItem>[0] & { onClick: () => void }) {
return <SearchResultItem {...props} />;
}

Expand All @@ -103,18 +103,19 @@ export default function HybridSearchDialog({
};
}, [api, props.open]);
// Re-run the current query once the semantic index arrives.
const deps = useMemo(() => [client, loaded], [client, loaded]);
const { search, setSearch, query } = useDocsSearch({ client }, deps);
// oxlint-disable-next-line react-hooks/exhaustive-deps -- `loaded` re-runs the current query once the semantic index arrives.
const run = useCallback((query: string) => client.search(query), [client, loaded]);
const search = experimental_useSearch(run);
return (
<SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
<SearchDialog {...search} {...props}>
<SearchDialogOverlay />
<SearchDialogContent>
<SearchDialogHeader>
<SearchDialogIcon />
<SearchDialogInput />
<SearchDialogClose />
</SearchDialogHeader>
<SearchDialogList items={query.data !== "empty" ? query.data : null} Item={renderResult} />
<SearchDialogList Item={renderResult} Table={renderSearchTable} />
</SearchDialogContent>
</SearchDialog>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/docs-next/src/provider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ test("options.search.enabled and hotKey reach the provider's search prop", () =>
});

// The forwarded field is named `api` (not `from`, `url`, or `src`): verified
// against fumadocs-ui@16.10.5's `DefaultSearchDialog` props (the pinned
// version, per the catalog in the workspace root). A fumadocs upgrade that
// against fumadocs-ui's `DefaultSearchDialog` props (the version pinned
// in the workspace catalog). A fumadocs upgrade that
// renames this field must re-check this mapping in `buildSearchProp`.
test("options.search.from reaches the static search client's index URL", () => {
captured.props = undefined;
Expand Down
Loading
Loading