Copy as Markdown
The Copy as Markdown action fetches the page’s .md source and writes it
to the clipboard. The user gets the raw markdown body — the same content
served by the markdown route —
without leaving the page.
When to use it
Section titled “When to use it”- Pasting docs context into an LLM chat that doesn’t have URL prefill.
- Quoting an authoritative version of a page in a PR or issue.
- Feeding markdown into local tooling (note-taking apps, scripts, etc.).
Configuration
Section titled “Configuration”copyMarkdown is on by default. To disable it:
starlightLlmActions({ actions: { copyMarkdown: false, },})When disabled, the action is removed from the dropdown.
How it works
Section titled “How it works”The action runs entirely in the browser:
- The dropdown item resolves the page’s markdown URL using
markdownUrl(default/{slug}.md). - A
fetch()request retrieves the markdown. - The response body is written to the clipboard via the Async Clipboard API.
If the user’s browser blocks clipboard writes (e.g. on http:// origins
without explicit permission), the action falls back to selecting the
markdown into a hidden textarea and using document.execCommand('copy').
Modifying what gets copied
Section titled “Modifying what gets copied”The action copies whatever the markdown route serves. To change the copied
content, point markdownUrl at a different route:
starlightLlmActions({ markdownUrl: '/raw/{slug}.txt', injectRoute: false, // your route already serves the content})See markdownUrl
and injectRoute
for the full options.
See also
Section titled “See also”- View as Markdown — opens the markdown URL in the browser instead of copying.
- Open in… — sends the page (or a prompt referencing it) directly to an LLM.