Skip to content

fix(llms): keep component rewrites on fumadocs-core 16.19 and later - #20

Merged
aicayzer merged 3 commits into
mainfrom
fix/llms-fumadocs-16
Dec 2, 2026
Merged

aicayzer merged 3 commits into
mainfrom
fix/llms-fumadocs-16

Conversation

@aicayzer

@aicayzer aicayzer commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Markdown copies and llms-full.txt lose every component rewrite and code block header on fumadocs-core 16.17.0 and later, without a build error. Fumadocs now writes the copy from a page's own source, so LLMsOptions no longer accepts stringify or extensions and silently ignores them. This change writes the same copy through the API that replaced them, moves the development dependencies to the newest 16.x and 15.x, and narrows the peer ranges to the releases docs-kit is tested against. Closes #19

Changes

  • llmsOptions() is replaced by llmsCopy(), which returns { options, plugin }. options is { output: 'string' }. plugin is a remark plugin that calls replaceSource(file, node, text, 'markdown') from fumadocs-core/mdx-plugins/stringifier for each rewrite, wrapper, Figure: line, dropped component, code block with a note or status, code block with notation comments, and table. The markdown namespace keeps the edits out of search records.
  • Rewrites keep their public shape (attribute, inner, flow, node), now read from the page source instead of mdast stringification. Tables are written from their cells, so they stay unpadded whatever the source looks like, and a rewrite inside a cell still applies.
  • The site adds llms.plugin to remarkPlugins and passes llms.options to includeProcessedMarkdown. The README shows both.
  • Code tabs. A fenced block with tab="..." is written as its label in bold, then the fence without tab and tab-group. Fumadocs's remarkCodeTab reads those attributes into a tab element that has no position in the source, so a rewrite of that element can never apply. The plugin now writes what the element's rewrite puts around its content (the **label**) as an edit to the first node inside it that has a position, and rewrites the fence itself without the attributes.
  • Nodes another plugin adds. A table cell whose children a plugin replaced (a site's icon in a cell, for example) is written from those children and the site's rewrites, because the cell's source no longer holds them.
  • Includes need fumadocs-mdx 15.4.7 or later. The fumadocs-mdx peer moves from ^15.4.5 to ^15.4.7. Through 15.4.6, fumadocs-mdx's own remarkInclude puts the included file's nodes into the page tree without recording that their positions belong to another file, so every edit lands at the wrong offset of the page's source. 15.4.7 adds the embedSource call that fixes this. Nothing in the kit can repair it from outside: the copy is made from the source and the wrong offsets are already in the tree.
  • fumadocs-core and fumadocs-ui peers move from ^16.15.15 to ^16.19.7; dev dependencies move from 16.15.15 to 16.19.8, and fumadocs-mdx from 15.4.5 to 15.6.4. mdast-util-gfm-table is no longer used and is removed.
  • fumadocs-ui moves with core because each ui release pins fumadocs-core to its own version in its peer range, so 16.15.15 cannot sit beside core 16.19.8. The move needed three follow-ups: translations.ts renames three label keys (404 page became 404 not found page, mobile menu became home layout header) and adds the four new title-case labels (Skip to Content, Image Viewer, Next Image, Previous Image); translations.test.ts reads the renamed keys.json.js; the page actions test's fetch stub now returns ok: true, which ui 16.19 checks.
  • Tests: llms.test.ts runs the plugin and remarkLLMs as separate steps, adds cases for nesting in lists and quotes, longer fences, padded and aligned tables and components in cells, and a block that runs the installed fumadocs-mdx's own remarkInclude, the real Fumadocs preset (applyMdxPreset), the kit's plugin and remarkLLMs in the order of its loader. That block covers a page holding every rewrite, includes (relative and cwd, with a heading, a table and a code block inside; inside a component; a non-Markdown file; the same file twice; a tab inside an included file) and tab= blocks (labels, tab-group, title and note, several blocks in one tab, a tab in a list item), plus the install-tab case below and a plugin-added icon in a cell.

Testing

Run in the worktree through heavy-run, on fumadocs-core and fumadocs-ui 16.19.8 with fumadocs-mdx 15.6.4:

  • pnpm types:check: clean.
  • pnpm test: 34 files, 382 tests passed.
  • pnpm build: succeeded.
  • pnpm pack:check: "The package holds what it should and imports only what it declares."
  • The whole suite and types:check also pass on the declared floor: core and ui 16.19.7 with fumadocs-mdx 15.4.7.
  • The repository has no lint script.

Seen failing first: the previous llms.test.ts, run against 16.19.8, failed 16 of its tests. The include and tab tests added here fail on the previous head (b6674d5, with fumadocs-mdx 15.4.5): 8 tests, with the garbled output (## Fie [#identity]ld| every | m has | ...), the raw <include> tag and the tab="..." attributes in the copy. On the new code the five include tests still fail on fumadocs-mdx 15.4.5 and 15.4.6, and all pass on 15.4.7, 15.4.8, 15.4.9, 15.4.10, 15.5.0, 15.5.3, 15.6.0 and 15.6.4, each on core 16.19.7 and 16.19.8.

Against a real site: the kit was packed and installed in a scratch checkout of withmarfa/docs at main (not committed), with source.config.ts changed to llmsCopy and llms.plugin, and llms-full.txt from pnpm build was compared with the one from the kit at main on fumadocs-core 16.15.15. The new file is identical on fumadocs-mdx 15.4.7 and 15.6.4. After ignoring list markers (* and -), blank lines and trailing whitespace, 12,521 old lines and the new file differ only as listed under Output differences. No <include tag and no tab= or tab-group text remains, all 757 heading anchors match, and the scratch checkout was restored to main.

Not tested: a build of either consuming site as committed (withmarfa/docs is out of scope here, and neither site is updated); fumadocs-mdx's own loader as a whole, whose postprocess step calls remarkLLMs, so the test runs the preset and remarkLLMs itself in that order; a <show> branch or output: 'function' content source, which the kit does not support.

Notes for reviewers

  • Breaking for sites. llmsOptions is gone, a site must add llms.plugin, and a site on fumadocs-mdx older than 15.4.7 must update it, or its copies of pages with <include> are garbled. Per AGENTS.md this needs a version bump and both consuming sites updated; no version is bumped here.
  • Why 16.19.7 and not 16.17. The new API needs the markdown namespace from 16.19.0. The ui floor is 16.19.7 because the label keys in fumadocs-ui changed between 16.19.5 and 16.19.7, so on an earlier ui the translations would silently stop applying. Because ui pins core exactly, a site on ui 16.19.7 or later is on core 16.19.7 or later, so both peers use that floor. The code itself works from core 16.19.0.
  • Silent failure remains if a site forgets the plugin: the copy then keeps components as written. The README says so. The options object cannot detect this, because filterElement receives a node and no file.
  • Output differences from the old stringifier, as seen on the docs site:
    • A fence the code leaves alone keeps the author's own fence, instead of a normalized one. A component's content comes from the source, so its whitespace follows what the author wrote, except that block children are joined with a blank line.
    • A tilde in prose is written as authored (~/Library/...), where the old copy escaped it (\~/Library/...).
    • The Types list on the Catalog page no longer holds the raw <Icon body="<path ...>" /> markup that the old copy leaked into the first cell of each row. The site's Icon rewrite says an icon is not text, and the cell now applies it. The Mark column of the connector index still writes the mark's ID, as before.
    • Empty table cells are written as | | where the old copy wrote | | (whitespace only).
    • An npm or package-install block keeps the fence as authored (```npm). The old copy read the generated install tabs from the tree and wrote them (inferred from the old code, not run). Fumadocs's own remarkNpm replaces the block with tabs that have no position and pins the authored block as the page's source, and the original node is no longer in the tree for the kit to rewrite. The docs site has no such block.
  • Review depth: the table, fence, wrapper and framing helpers are the new logic; the rest is wiring and dependency movement.

Checklist

  • The title is a scoped Conventional Commit.
  • New behavior has a test that was seen failing first, or no test was needed and the reason is above.
  • Docs, comments and the contract still say what is true after this change.

Fumadocs 16.17 writes the Markdown copy from a page's source, so the stringify and extensions options are gone. A remark plugin now edits the source for each rewrite, code block header and table. Floors move to 16.19.7 for core and ui, which pins core exactly; ui 16.19.7 renamed three label keys.

@aicayzer aicayzer left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: ready to merge

Summary. The kit writes the Markdown copy by editing the page's source through a remark plugin, which fumadocs-core 16.19 and later builds the copy from, and a real-site build now matches the copy made on 16.15.15; safe to merge, with the setup change below released together with the sites that adopt it.

First draft: 3/5. Unit and preset tests passed, but a build of docs.marfa.so against the packed kit showed three blocking faults, all fixed in b2d3142: <include> left as a raw tag, text garbled at wrong offsets on pages with includes, and tab= fences losing their label while leaking tab and tab-group.

Checked.

  • Done: the old llmsOptions on 16.15.15 and the new llmsCopy on 16.19.8 compared through the real applyMdxPreset on 14 pages, then on the docs site's whole llms-full.txt. After normalising list markers and blank lines, the only differences are 12 type-list rows that no longer leak raw <Icon> markup (correct under the site's Icon rewrite) and whitespace in empty table cells. No <include, tab= or tab-group text remains, and heading anchors match.
  • Every path: includes (relative, cwd, inside a component, the same file twice, a tab inside an include) and tab= blocks run through the installed fumadocs-mdx remarkInclude, the preset, the kit plugin and remarkLLMs; 8 of these fail on the previous head.
  • True: the peer floors are the first releases that work: fumadocs-core 16.19.0 for the markdown namespace, fumadocs-ui 16.19.7 for the renamed label keys (one floor for both, as ui pins core), and fumadocs-mdx 15.4.7, the first that records an included file's source with embedSource. The full suite passes at the floor and on the newest releases.
  • Stale instructions: the README states the new setup (llms.options and llms.plugin), the floors and why, and how npm and tab= blocks are copied.

Found.

  • Raw <include> and garbled text on pages with includes. fumadocs-mdx before 15.4.7 does not record where included text came from. Fixed in b2d3142 by raising the peer floor; tests run the real remarkInclude. Done
  • tab= fences lost their label and leaked attributes. Fixed in b2d3142: the label goes on the first positioned node inside the tab, and the fence drops tab and tab-group. Done
  • Plugin-added nodes in table cells were dropped. A cell holding an unpositioned node is now written from its children. Fixed in b2d3142. Every path
  • A callout opening with a fenced block glued the fence to the title line (also on main). Fixed in b6674d5. Every path
  • A comment named Fumadocs 16.15. Reworded in b6674d5. Stale instructions
  • npm and package-install blocks keep the authored fence instead of one fence per package manager, because remarkNpm pins the authored block as the source. Accepted and documented in the README; no information is lost. Done

For an issue.

  • Breaking change for both sites. llmsOptions is gone. The next docs-kit release needs a version bump, and each site must add llms.plugin and move to fumadocs-core/fumadocs-ui 16.19.7+ and fumadocs-mdx 15.4.7+ when it adopts that release. A site that omits the plugin builds without error but copies components as written.

Reviewed by withmarfa-reviewer on claude-sonnet-5-5, with a real-site check by the session. This review may contain mistakes.

@aicayzer
aicayzer marked this pull request as ready for review December 2, 2026 03:37
@aicayzer
aicayzer merged commit 53267cd into main Dec 2, 2026
11 checks passed
@aicayzer
aicayzer deleted the fix/llms-fumadocs-16 branch December 2, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown copies keep component rewrites on current fumadocs-core

1 participant