# Copy Page as Markdown PRD ## Status - Draft (not started) ## Purpose Give learners on public course pages a one-click way to export lesson content as Markdown and hand it off to an AI tool. The pattern is the same split-button found on Vercel, Next.js, and shadcn-svelte docs: - **Primary "Copy Page"** copies the lesson as Markdown to the clipboard. - **Chevron dropdown** exposes: - View as Markdown - Open in ChatGPT - Open in Claude Teachers control whether this surface appears, per course, via a setting in course settings. ## Motivation Learners increasingly mix course content with AI tools — pasting lesson text into ChatGPT/Claude to ask follow-up questions, get worked examples, or debug exercises. Today they manually select-and-copy from the page, which captures HTML noise, broken whitespace, and embedded video chrome. Shipping a first-class "Copy Page" action: 1. Removes the friction of switching between the lesson and an AI tool. 2. Produces clean Markdown (no iframes, no video embeds, no rich-text artefacts) so the AI tool receives high-quality context. 3. Matches the convention learners already see on modern documentation sites — feels native to anyone who uses them. ## Scope ### In scope (v1) - Public lesson pages only: `/course/[slug]/lesson/[itemSlug]`. - Per-course toggle in course settings (`metadata.allowMarkdownExport`). Default: off. - Server-side HTML → Markdown conversion with videos stripped. - A bookmarkable `.../markdown` URL that returns the lesson as `text/markdown`. - Split button on the public lesson shell with four actions: Copy Page, View as Markdown, Open in ChatGPT, Open in Claude. ### Out of scope (v1) - Course landing pages, section pages, and any non-lesson public surface. - `Open in v0` (skipped — most lessons aren't UI/component focused). - Bulk export of an entire course as a single Markdown document. - Authenticated dashboard surfaces (only public pages get the action). - Localised Markdown output (initial release exports the lesson's current locale verbatim). ## Confirmed Decisions 1. **Scope is lesson pages only.** Landing and section pages are deferred until there is signal that learners want them. 2. **Per-course toggle is stored on `course.metadata`.** This matches the existing pattern used by `lessonDownload`, `grading`, and `allowNewStudent`, so no new column or migration is required. 3. **Default value is off.** Teachers must explicitly opt in. This avoids silently exposing course content as easily copyable Markdown to courses created before the feature shipped. 4. **HTML → Markdown conversion runs on the server**, not in the browser, so the `turndown` dependency does not ship to learners and a real bookmarkable `.md` URL exists. 5. **Videos are excluded** from the Markdown output. `