Ship the bundled docs as Markdown, not the website's MDX (#102509)
The installed docs currently use a `.md` extension but still contain the
website’s MDX. Two changes you can verify in the [parent
package](https://vercel-packages.vercel.app/next/commits/ff10276381fa644f30ad1c2710a09c8d0f84ab04/next)
and the [converted
package](https://vercel-packages.vercel.app/next/commits/b39fbcd5678cc881fd67c59d060c6ef7a2650e02/next):
- **117 shared Pages Router pages gain their missing article bodies.**
For example, `dist/docs/pages/guides/instrumentation.md` used to contain
only metadata and a note to docs authors. The same file now tells
readers where to put `instrumentation.ts`, what to export, and when
Next.js calls `register`.
- **A reader reaches the worked example sooner.** Open
`dist/docs/app/guides/adopting-partial-prefetching.md` and read the
first 350 lines. With Markdown, that includes both halves of the
Suspense fix: the parent passes the promise without awaiting it, and the
child awaits it inside the boundary. In the original file, the worked
repair starts on line 421.
This builds on #102607, which fixes installed paths and links and adds
`llms.txt`. This PR changes **what a reader sees after opening a page**.
### Operations Dashboard comparison
**Neither build passed the task in three graded attempts.** On the same
model, harness, prompt and 39 checks, the parent scored 34, 35 and 37;
the Markdown build scored 34, 34 and 37. All six missed recovery from a
service error without losing the selected filters.
| Build | Checks passed (out of 39) | Total session tokens, median
(range) | Coding time, median (range) |
| --- | --- | --- | --- |
| Parent `ff102763` | 34, 35, 37 | 6.70M (5.67M–9.39M) | 25:15
(20:17–29:50) |
| Markdown `b39fbcd` | 34, 34, 37 | 4.84M (4.82M–13.44M) | 19:01
(18:22–30:21) |
The Markdown build had both the shortest and the longest attempt. Its
median token count was lower, but its three graded attempts **together
used more tokens** than the parent’s. These numbers cover the whole
coding session, including repeated cached input; they do not measure
peak context or tokens spent reading docs.
The first batch hit its shared spend limit. Its two graded Markdown
attempts were kept; four fresh attempts on the same builds replaced the
cancelled ones. The table excludes those interrupted sessions. With
three graded attempts per build and this replacement procedure, there is
no reliable score or whole-session token advantage.
**Tokens per documentation read.** Across 120 successful reads of 29
pages in the six graded attempts, the same file and requested lines
averaged **4,352 tokens on the parent → 3,873 with Markdown**: **479
fewer per read (11.0%)**. The median saving was 182 tokens. We counted
the document text once with `o200k_base`, excluding tool formatting.
This measures the size of the text returned, not billed usage or peak
context.
| Full App Router page | Parent | Markdown | Difference |
| --- | ---: | ---: | ---: |
| Link component | 9,105 | 4,511 | 4,594 fewer |
| Adopting Partial Prefetching | 5,924 | 4,918 | 1,006 fewer |
| cacheComponents config | 1,048 | 1,187 | 139 more |
The Link page drops Pages Router sections and paired JavaScript
examples. The cacheComponents page grows because it gains four related
links with descriptions.
<details>
<summary>What gets converted and how docs PRs are checked</summary>
- **Router content.** App and Pages Router files keep the passages for
their own router. A page that points to shared source gets that source’s
body, rendered for the router the reader opened.
- **Code samples.** For an authored TypeScript/JavaScript switcher pair,
the bundle keeps the TypeScript example. Standalone JavaScript examples
stay. For example, *Adopting Partial Prefetching* keeps all 12 TSX
examples and drops 11 paired JSX examples. The converter edits the
website constructs at their source positions so it can preserve the code
inside the examples it keeps.
- **Navigation and media.** Authored related links keep their order.
Other section pages list their published children below the
introduction. Error-page fix cards keep their linked titles and code.
Images and videos keep their alt text or captions when a build has no
configured media store.
- **Verification.** Docs PRs build the package’s own Markdown and
validate it against the MDX from the same commit, including docs-only
changes. The [current hosted corpus and link
suite](https://github.com/vercel/next.js/actions/runs/46651995662/job/142658842495)
passed **35/35** on `c11230f`; the [docs link
check](https://github.com/vercel/next.js/actions/runs/46651995662/job/142658674013)
and [full build and test
workflow](https://github.com/vercel/next.js/actions/runs/46651995662/attempts/2)
also passed.
</details>
<!-- NEXT_JS_LLM -->
---------
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>