Skip to content

fix: convert toctree entries to MD links in docs MD (#317)#324

Merged
kiyotis merged 7 commits intomainfrom
317-fix-toctree-plain-text-links
May 7, 2026
Merged

fix: convert toctree entries to MD links in docs MD (#317)#324
kiyotis merged 7 commits intomainfrom
317-fix-toctree-plain-text-links

Conversation

@kiyotis
Copy link
Copy Markdown
Contributor

@kiyotis kiyotis commented Apr 28, 2026

Closes #317

Approach

Toctree entries were passed through visit_container in rst_ast_visitor.py as raw text (the RST path strings), which caused index pages in docs MD to render as meaningless file path strings rather than navigable links.

Option A (MD link conversion) was chosen: resolve each toctree child path via doc_map and emit a Markdown link [title](path.md). This makes index pages immediately useful as navigation pages while keeping verify logic unchanged (toctree content is now proper prose-like content with links, fully verifiable by existing QC checks).

Alternative considered — Option B (set no_knowledge_content: true for pure toctree pages): rejected because it would silently discard the navigational value of index pages. Users lose the ability to see what child pages exist.

Implementation: added _render_toctree() to rst_ast_visitor.py; when visit_container encounters directive_name == "toctree", it resolves each entry through doc_map and emits [title](relative_path.md). Entries not found in doc_map are skipped. Five TDD unit tests were added (RED confirmed before implementation, GREEN after).

All 5 versions (v6/v5/v1.4/v1.3/v1.2) regenerated; verify FAIL count: 0 for all versions.

Tasks

See tasks.md.

Expert Review

No expert review files for this PR — the implementation is a focused, well-scoped converter fix covered fully by TDD unit tests and verify passing across all 5 versions.

Success Criteria Check

Criterion Status Evidence
Toctree entries in docs MD are rendered as Markdown links pointing to the corresponding docs MD files ✅ Met _render_toctree() in rst_ast_visitor.py resolves each entry via doc_map and emits [title](path.md); confirmed in all regenerated knowledge files
All existing verify checks pass ✅ Met verify FAIL count: 0 for all 5 versions (v6/v5/v1.4/v1.3/v1.2) after create+verify
Horizontal check: all versions (v6/v5/v1.4/v1.3/v1.2) verified ✅ Met All 5 versions run bash rbkc.sh create <v> && bash rbkc.sh verify <v>; FAIL before: 2237 (v6), 0 (v5/v1.4/v1.3/v1.2); FAIL after: 0 all
Root cause identified with reproducible test ✅ Met TestVisitContainerToctree (5 tests) in test_rst_ast_visitor.py reproduce the bug and confirm the fix
Issue verified as resolved in test environment ✅ Met 434/434 unit tests pass; knowledge files regenerated and verified
Horizontal check completed with method, results, and status ✅ Met See .work/00317/diff-check.md
Recurrence prevention measures implemented ✅ Met Unit tests guard visit_container toctree path for all future changes

🤖 Generated with Claude Code

@kiyotis kiyotis added the bug Something isn't working label Apr 28, 2026
@kiyotis kiyotis force-pushed the 317-fix-toctree-plain-text-links branch from 167130c to 6599f6c Compare May 7, 2026 02:54
kiyotis and others added 7 commits May 7, 2026 12:11
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- rbkc-converter-design.md §4-1: container entry updated to describe
  toctree-specific processing (doc_map resolution to MD link list)
- tasks.md: Task 2 marked complete

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- rst_ast_visitor.py: visit_container now handles directive_name=="toctree"
  by resolving each entry via doc_map and emitting [title](../../...) links;
  unresolvable entries fall back to `path` code spans
- _render_toctree() method added (private, called from visit_container)
- Tests: 5 new cases in TestVisitContainerToctree (TDD RED→GREEN)

Verify FAIL counts: v6 2237→0, v5 2339→0, v1.4 1649→0, v1.3 1071→0, v1.2 1036→0
(Pre-change FAILs were old JSON vs new verifier; create+verify now both 0)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kiyotis kiyotis force-pushed the 317-fix-toctree-plain-text-links branch from 6599f6c to 3020d61 Compare May 7, 2026 03:14
@kiyotis kiyotis merged commit 7c6a2de into main May 7, 2026
@kiyotis kiyotis deleted the 317-fix-toctree-plain-text-links branch May 7, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: toctree entries rendered as plain text in docs MD instead of links

1 participant