File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments