Title
Feature: Copy as Markdown for page and section content
Summary
- Add an optional "Copy as Markdown" action that copies either:
- the entire page, or
- the current section (from the focused heading to the next same-level heading).
- Goal: make it effortless to share docs context with AI assistants, agentic coding tools, and issue trackers while preserving Markdown semantics.
Motivation
- This is becoming a common pattern on modern docs sites. The Anthropic docs (https://docs.anthropic.com/) are a good example of AI-friendly documentation with strong copy interactions geared for downstream tooling.
- Starlight already provides copy buttons for code blocks via Expressive Code; extending this to page/section content unlocks high‑value AI and agent workflows.
Edge Cases
- Interactive/MDX-only components: degrade gracefully with best-effort Markdown.
- Image/asset paths: preserve relative URLs by default; allow an option to absolutize links.
- Tables/admonitions: ensure readable, portable Markdown output.
Configuration (example)
// starlight.config.ts
export default defineConfig({
// ...
copyMarkdown: {
enabled: true,
scope: 'both', // 'page' | 'section' | 'both'
includeFrontmatter: false,
linkStyle: 'inline', // 'inline' | 'reference'
implementation: 'html-to-md', // 'html-to-md' | 'static-asset'
},
})
Prior Art
Request
- Would this belong in core Starlight or as an official plugin?
- If the direction sounds good, I’m happy to help with an initial prototype/PR.
Screenshots / examples
Title
Feature: Copy as Markdown for page and section content
Summary
Motivation
Edge Cases
Configuration (example)
Prior Art
Request
Screenshots / examples
Anthropic docs:
zod.dev refinements section: