Skip to content

Commit a5f1f03

Browse files
committed
Document docs anchor vs normalize pipeline
1 parent ea18a9d commit a5f1f03

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

CONTRIBUTING.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ If the hook fails, fix the reported issues and retry the commit.
8282

8383
### Docs Normalization (AST pipeline)
8484

85-
We run a deterministic Markdown normalizer (unified/remark) as a prebuild check. It parses Markdown to an AST, applies project transforms (anchors, TOC, link fixes), and stringifies back. This keeps anchors and spacing lint-clean and idempotent.
85+
We run a deterministic Markdown normalizer (unified/remark) as a prebuild check. It parses Markdown to an AST, applies project transforms (link fixes, SPEC/TECH-SPEC linkification), and stringifies back. This keeps formatting/linting idempotent without touching anchors.
8686

8787
Manual runs:
8888

@@ -91,6 +91,26 @@ npm run docs:normalize # write normalized Markdown
9191
npm run docs:normalize:check # fail if normalization would change files
9292
```
9393

94+
#### Anchors & TOC vs normalize
95+
96+
Two different tools touch documentation, with clear separation of concerns:
97+
98+
- `scripts/anchors_and_toc.py` (Python):
99+
- Sole owner of `<a id="…"></a>` anchors and AUTOGENERATED TOC blocks.
100+
- Use when you change headings or want to regenerate anchors/TOCs:
101+
- `python3 scripts/anchors_and_toc.py --write --paths docs/FEATURES.md`
102+
- CI may run this on specific files before docs build.
103+
104+
- `npm run docs:normalize` (Node/remark):
105+
- Does **not** create or modify anchors/TOCs — it preserves whatever is in the Markdown.
106+
- Only normalizes markdown syntax and fixes SPEC/TECH-SPEC links / relative paths.
107+
- Safe to run frequently; it is idempotent by design.
108+
109+
Rule of thumb:
110+
111+
- If you edited headings/sections and need fresh anchors or TOC entries, run the Python anchor script.
112+
- For day-to-day changes (copy edits, extra paragraphs, examples), just run `npm run docs:normalize` and rely on the pre-push hook.
113+
94114
Pre-push hook (opt-out flags; each step runs by default):
95115

96116
- Set `PREPUSH_SKIP_DOCS=1` to skip the VitePress docs build.

0 commit comments

Comments
 (0)