Skip to content

Commit 8b054ce

Browse files
authored
Merge pull request #188 from braboj/docs/recipe-link-convention
docs: add recipe-to-recipe link convention to CLAUDE.md
2 parents 5fb7ee4 + fe2781c commit 8b054ce

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

CLAUDE.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,20 @@ Every chapter follows this structure:
101101

102102
### 2.4 Cross-references
103103

104-
- Reference other chapters by file: `[Building Blocks](02-building-blocks.md)`
105104
- Reference sections within a chapter by heading anchor: `[Tag Object](#tag-object-labels)`
106-
- Markdown links must use the **URL path** (driven by `section` frontmatter),
107-
not the filesystem path — the remark plugin
108-
(`astro-site/src/plugins/remark-rewrite-links.ts`) rewrites links at
109-
build time
110-
- Recipe pages live in `chapters/recipes/` but their URLs are
111-
`/playbook/...` — link to them as `playbook/X.md`, not `recipes/X.md`
105+
- The remark plugin (`astro-site/src/plugins/remark-rewrite-links.ts`)
106+
rewrites `.md` links at build time — use the correct format depending
107+
on source and target:
108+
109+
| From → To | Link format | Example |
110+
|-----------|-------------|---------|
111+
| Chapter → chapter | `NN-slug.md` | `[Glossary](09-glossary.md)``../glossary/` |
112+
| Chapter → recipe | `playbook/slug.md` | `[Debugging](playbook/debugging.md)``../playbook/debugging/` |
113+
| Recipe → recipe | `../slug/` (raw URL) | `[Hooks](../hooks/)` — rewriter ignores it, browser resolves correctly |
114+
115+
- **Never use `slug.md`** for recipe-to-recipe links — the sibling
116+
rewriter turns it into `slug/` which resolves to
117+
`/playbook/current/slug/` instead of `/playbook/slug/`
112118

113119
### 2.5 Images
114120

0 commit comments

Comments
 (0)