Problem
Leadtype already generates flattened markdown mirrors, but framework integration still requires users to manually wire routes. This route layer is central to Leadtype's agent-readability story and should be easier to adopt.
Expected behavior:
/docs/foo serves human HTML through the host app.
/docs/foo.md serves flattened markdown.
Accept: text/markdown can return flattened markdown where practical.
/llms.txt links resolve to markdown-friendly URLs.
Proposal
Add first-class raw markdown and content negotiation recipes per framework, supported by small core helpers.
Possible core helper:
resolveMarkdownAsset({
slug,
collection: "docs",
manifest,
});
The core helper should return plain data: status, content type, body, path metadata, and cache metadata. Framework adapters/recipes can translate that into the host's response object.
Framework Integration Notes
- Next.js:
app/docs/[[...slug]]/route.ts or explicit markdown route.
- Nuxt:
server/routes/docs/[...slug].md.get.ts and/or Nitro middleware.
- SvelteKit:
src/routes/docs/[...slug]/+server.ts for content negotiation and an explicit .md route if verified in a fixture.
- Astro: endpoint route such as
src/pages/docs/[...slug].md.ts.
- Cloudflare Workers: Worker handler using generated artifacts.
- TanStack Start: server route/function recipe.
Acceptance Criteria
Problem
Leadtype already generates flattened markdown mirrors, but framework integration still requires users to manually wire routes. This route layer is central to Leadtype's agent-readability story and should be easier to adopt.
Expected behavior:
/docs/fooserves human HTML through the host app./docs/foo.mdserves flattened markdown.Accept: text/markdowncan return flattened markdown where practical./llms.txtlinks resolve to markdown-friendly URLs.Proposal
Add first-class raw markdown and content negotiation recipes per framework, supported by small core helpers.
Possible core helper:
The core helper should return plain data: status, content type, body, path metadata, and cache metadata. Framework adapters/recipes can translate that into the host's response object.
Framework Integration Notes
app/docs/[[...slug]]/route.tsor explicit markdown route.server/routes/docs/[...slug].md.get.tsand/or Nitro middleware.src/routes/docs/[...slug]/+server.tsfor content negotiation and an explicit.mdroute if verified in a fixture.src/pages/docs/[...slug].md.ts.Acceptance Criteria
text/markdown; charset=utf-8..mdURLs are supported consistently where framework routing allows.Accept: text/markdownbehavior is documented as optional/conservative./llms.txtgenerated links point at markdown-friendly routes.