@@ -82,14 +82,15 @@ make test # Includes TOC anchor validation tests
8282
8383## HTML Fixture Storage
8484
85- GitHub-rendered HTML fixtures are stored in ` tests/fixtures/github-html/ ` (version controlled):
85+ GitHub-rendered HTML fixtures are stored in ` tests/fixtures/github-html/ ` (version controlled).
86+ Fixture filenames indicate root vs non-root placement to detect potential rendering differences:
8687
87- | Style | README Path | HTML Fixture Path |
88- | -------| -------------| -------------------|
89- | AWESOME | ` README.md ` | ` tests/fixtures/github-html/ awesome.html` |
90- | CLASSIC | ` README_ALTERNATIVES/README_CLASSIC.md ` | ` tests/fixtures/github-html/ classic.html` |
91- | EXTRA | ` README_ALTERNATIVES/README_EXTRA.md ` | ` tests/fixtures/github-html/ extra.html` |
92- | FLAT | ` README_ALTERNATIVES/README_FLAT_ALL_AZ.md ` | ` tests/fixtures/github-html/ flat.html` |
88+ | Style | README Path | HTML Fixture | Placement |
89+ | -------| -------------| --------------| ------ -----|
90+ | AWESOME | ` README.md ` | ` awesome-root .html ` | Root |
91+ | CLASSIC | ` README_ALTERNATIVES/README_CLASSIC.md ` | ` classic-non-root .html ` | Non-root |
92+ | EXTRA | ` README_ALTERNATIVES/README_EXTRA.md ` | ` extra-non-root .html ` | Non-root |
93+ | FLAT | ` README_ALTERNATIVES/README_FLAT_ALL_AZ.md ` | ` flat-non-root .html ` | Non-root |
9394
9495Validation commands:
9596``` bash
@@ -102,17 +103,55 @@ python3 -m scripts.testing.validate_toc_anchors --style extra
102103python3 -m scripts.testing.validate_toc_anchors --style flat
103104```
104105
105- ## Remaining Work
106+ ## Validation Status
106107
107- | Style | Validated | Notes |
108- | -------| ----------- | -------|
109- | AWESOME | ✅ | Root README, tested and fixed |
110- | CLASSIC | ✅ | Tested and fixed (different anchor format due to 🔝 in headings) |
111- | EXTRA | ❌ | Uses explicit ` id ` attributes; needs validation |
112- | FLAT | ❌ | Simpler format (no subcategories); needs validation |
108+ | Style | Status | Notes |
109+ | -------| --------| -------|
110+ | AWESOME | ✅ | Root README, 30 TOC anchors verified |
111+ | CLASSIC | ✅ | Different anchor format due to 🔝 in headings |
112+ | EXTRA | ✅ | Uses explicit ` id ` attributes; template anchor fixed |
113+ | FLAT | ✅ | No TOC anchors (flat list format) |
113114
114- ### TODO
115- - [ ] Download GitHub HTML for EXTRA style and validate
116- - [ ] Download GitHub HTML for FLAT style and validate
117- - [ ] Fix any anchor mismatches found in EXTRA/FLAT
118- - [ ] Consider unifying anchor generation logic into shared helpers
115+ ## Future Work
116+
117+ - [ ] Unify anchor generation logic into shared helper with parameterized flags
118+ - [ ] Add CI job to validate TOC anchors on README changes
119+
120+ ---
121+
122+ ## Architectural Decision: Anchor Generation Unification
123+
124+ ** Date** : 2026-01-09
125+
126+ ** Context** : TOC anchor generation logic is duplicated across three files (` awesome.py ` , ` minimal.py ` , ` visual.py ` ) with subtle differences due to each style's heading format.
127+
128+ ** Options Considered** :
129+
130+ 1 . ** Parameterized flags** - Create shared helper with semantic flags like ` has_back_to_top_in_heading `
131+ 2 . ** Unify to ID-based** - Migrate all styles to use explicit ` <h2 id="..."> ` like EXTRA
132+
133+ ** Decision** : Option 1 (parameterized flags)
134+
135+ ** Rationale** :
136+ - Lower risk: heading markup remains unchanged
137+ - AWESOME style intentionally uses clean markdown (` ## Title ` ) for aesthetic reasons
138+ - ID-based approach would require CLASSIC to restructure its ` [🔝](#...) ` links
139+ - Parameterized flags are self-documenting and decouple anchor logic from style names
140+
141+ ** Proposed API** :
142+ ``` python
143+ def generate_toc_anchor (
144+ title : str ,
145+ icon : str | None = None ,
146+ has_back_to_top_in_heading : bool = False ,
147+ ) -> str :
148+ """ Generate TOC anchor for a heading.
149+
150+ Args:
151+ title: The heading text (e.g., "Agent Skills")
152+ icon: Optional trailing emoji icon (e.g., "🤖")
153+ has_back_to_top_in_heading: True if heading contains 🔝 back-to-top link
154+ """
155+ ```
156+
157+ ** Trade-off** : If a style changes its heading format (e.g., CLASSIC removes 🔝), only the flag value changes—not the shared logic.
0 commit comments