Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ people. All of it is generated — none of it is a list to keep up to date by ha
`.md` twins below, not the pages: what follows an entry there is an agent.
- **A `.md` twin of every docs page**, from `src/pages/docs/[slug].md.ts`:
`/docs/reading` is the page, `/docs/reading.md` is the markdown it was
rendered from. The "Copy markdown" button on each page fetches its own twin,
rendered from. The "Copy .md" button on each page fetches its own twin,
so the HTML never carries a second copy of the prose. The body is served
verbatim except for its links, which are resolved to absolute URLs through the
same `rewriteLink` the rendered page uses — exported from
Expand Down
11 changes: 5 additions & 6 deletions web/src/pages/docs/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ const schema = faq?.length
<div class="doc">
<DocsNav current={page.id} headings={headings} />
<main class="doc__body">
{/* Above the title rather than beside it: the h1 wraps to three lines on
a phone, and there is no room to put anything next to it. */}
{/* Floated rather than laid out in a row: the h1 it sits beside is
rendered markdown, so there is no wrapper to make a flex parent of. */}
<div class="doctools">
<button type="button" class="doctools__copy" data-copy-md={`/docs/${page.id}.md`}>
<Icon name="copy" size={14} />
<Icon name="check" size={14} />
<span data-copy-md-label>Copy markdown</span>
<span data-copy-md-label>Copy .md</span>
</button>
</div>
<Content />
Expand Down Expand Up @@ -100,9 +100,8 @@ const schema = faq?.length
/* Reading controls, not content — quieter than anything inside the prose, and
sitting above the h1 rather than in the flow of it. */
.doctools {
display: flex;
justify-content: flex-end;
margin-bottom: 14px;
float: right;
margin: 4px 0 12px 20px;
}

.doctools__copy {
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/docs/[slug].md.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// The markdown behind every docs page, at the page's own URL plus `.md`:
// /docs/reading is the page, /docs/reading.md is what it was rendered from.
// Agents and LLMs get the source instead of parsing the HTML back into prose,
// and the "Copy markdown" button on each page fetches its own twin.
// and the "Copy .md" button on each page fetches its own twin.
//
// The body is served verbatim except for its links, which are written as
// on-disk relative paths (`../cli.md`) so they resolve in Reader.md and on
Expand Down
2 changes: 1 addition & 1 deletion web/src/scripts/copy-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function initCopyMarkdown() {
clearTimeout(timer);
timer = window.setTimeout(() => {
button.classList.remove("is-copied");
if (label) label.textContent = "Copy markdown";
if (label) label.textContent = "Copy .md";
}, RESET);
});
}
Loading