# Markdown export

> Every docs page is also available as raw MDX at `/path.md`. Appends no `.mintlify/llms` magic — the URL convention is the API. Works with any LLM, any scraper, any clipboard.

<!-- icon: file-down -->

NookDocs assumes you'll hand pages off to LLMs — to summarise, extend, translate, or regenerate. That handoff needs the **source**, not the rendered HTML. We expose the source at a stable `/path.md` URL on every page, plus a one-click clipboard affordance in the UI.

## The `.md` URL convention

Append `.md` to any docs page URL and the server returns the raw MDX source with `Content-Type: text/markdown`.

```text
# Rendered HTML
https://docs.acme.com/quickstart

# Raw MDX source (same content, different format)
https://docs.acme.com/quickstart.md
```

Works on any tenant, any custom domain, any path depth:

```text
https://docs.acme.com/api/authentication.md
https://docs.acme.com/configuration/theme.md
https://docs.acme.com/.md                    # root page
```

Try it on this page: [`/optimize/markdown-export.md`](/optimize/markdown-export.md).

## What you get back

Exact MDX source from your repo — frontmatter included, components intact, no HTML escaping. Example (abridged):

```text
---
title: Markdown export
description: Every docs page is also available as raw MDX...
icon: file-down
---

NookDocs assumes you'll hand pages off to LLMs...

<ParamField path="...">
  ...
</ParamField>
```

Headers:

- `Content-Type: text/markdown; charset=utf-8`
- `Cache-Control: public, max-age=300, s-maxage=300, stale-while-revalidate=3600`

No authentication required for public pages. Pages hidden via `hidden: true` frontmatter return a 404 at the `.md` URL too.

## Use cases

### Paste into any LLM

```text
Reader: "summarise this for me"
→ paste /my-page.md contents
→ LLM understands the component set + body + frontmatter
```

### Script-assisted content operations

```bash
# Pull a page, run a diff, open an issue when it drifts from your style guide
curl -sL https://docs.acme.com/quickstart.md | ./lint-style.py
```

```bash
# Export every page as MDX for a one-off migration
curl -sL https://docs.acme.com/sitemap.xml | \
  xmllint --xpath "//*[local-name()='loc']/text()" - | \
  xargs -I{} curl -sL "{}.md" -o "./export/$(basename {}).md"
```

### Claude Projects / ChatGPT Custom GPTs

Most LLM providers accept a docs-site URL and will fetch `/llms.txt` + per-page `.md` URLs automatically. See [llms.txt](/optimize/llms-txt) for the index file format.

## Copy from the UI

Every docs page also ships a **Copy page** split button in the top-end corner of the page header. The primary click copies the raw Markdown to your clipboard; the chevron opens the [contextual menu](/configuration/contextual) with deep-links to ChatGPT / Claude / Perplexity / Cursor / Windsurf / VS Code / MCP clients.

<Steps>
  <Step title="Click Copy page">
    Plain MDX source, no decoration. Same content as the `.md` URL returns.
  </Step>
  <Step title="Click Copy as Markdown for LLMs">
    Same source prefixed with a component-reference header so the LLM knows the NookDocs component library without fine-tuning.
  </Step>
  <Step title="Click Open in ChatGPT / Claude / Perplexity">
    Deep-links the provider with the page content pre-loaded as context.
  </Step>
</Steps>

The "Markdown for LLMs" variant wraps the source with an auto-generated component spec (see [copy for LLMs](/features/copy-for-llms) for the exact header format).

## Limitations

- **No `Accept: text/markdown` content negotiation yet.** Mintlify lets you send an `Accept: text/markdown` header to the HTML URL and get Markdown back; NookDocs only exposes the `.md` suffix for now. The `.md` URL always works.
- **No HTTP `Link` / `X-Llms-Txt` discovery headers yet.** Clients that auto-discover Markdown variants from response headers won't find them. Direct URL access works.
- **No `Cmd+C` → full-page-as-Markdown keyboard shortcut.** The Copy button is the only UI affordance right now; keyboard shortcut is on the roadmap.
- **Binary assets excluded.** Images and PDFs return a 404 at `.md`. Only MDX source pages respond.

## Related

- [llms.txt](/optimize/llms-txt) — sitemap-style index of every page's `.md` URL
- [Contextual menu](/configuration/contextual) — Copy-page dropdown + custom items (ChatGPT / Claude / Cursor deep-links)
- [Copy for LLMs](/features/copy-for-llms) — the UI variant with component-spec header
- [SEO](/optimize/seo) — sitemap.xml + robots.txt + canonical URLs
