Skip to content

Add llms.txt and markdown versions of the docs - #273

Merged
Seldaek merged 4 commits into
mainfrom
llms-txt
Oct 23, 2026
Merged

Seldaek merged 4 commits into
mainfrom
llms-txt

Conversation

@Seldaek

@Seldaek Seldaek commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Makes the docs easier for LLM agents to consume, following the llms.txt convention:

  • /llms.txt: index of the Book, Articles and FAQs (with taglines where available), each linking to its markdown version, plus the composer.json schema and changelog.
  • /llms-full.txt: all doc pages concatenated, each prefixed with its source URL.
  • /doc/<page>.md.md: raw markdown of a page (.md appended as per the llms.txt convention, since our URLs already end in .md). Served as text/markdown with a canonical Link header pointing to the HTML page.
  • HTML doc pages advertise their markdown version with <link rel="alternate" type="text/markdown">.

The markdown is the source from vendor/composer/composer/doc with the metadata comment stripped and relative doc links (inline, reference-style and #anchor) rewritten to the absolute markdown URLs, so they resolve both standalone and in llms-full.txt. Code fences and spans, absolute paths and targets outside the doc dir are left as is.

Moved pages redirect on the markdown URLs too, and the text responses are publicly cacheable for an hour.

The page listing from the /doc/ index was extracted into a method so it is shared with llms.txt.

Each doc page is served as markdown at /doc/<page>.md.md (the llms.txt
convention of appending .md), with relative links made absolute and the
metadata comment stripped. HTML doc pages advertise it via a
rel=alternate link.
- Require a boundary after .md, and leave absolute targets, targets
  climbing out of the doc dir, and code fences/spans untouched
- Match reference definitions indented by up to three spaces
- Resolve paths with Symfony's Path::canonicalize
- Redirect moved pages on the .md.md route as well
- Read each doc file once for llms-full.txt and cache the text responses
- Drop the precomputed link from the page listing
@Seldaek
Seldaek merged commit 52c6aef into main Oct 23, 2026
8 checks passed
@Seldaek
Seldaek deleted the llms-txt branch October 23, 2026 09:47
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.

1 participant