Repository navigation
Conversation
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
…dings (DeusData#2586) A Section's qualified name is the file's module plus the heading text, so two `## Implementation` headings under `# Service A` and `# Service B` had one qualified name. The graph kept one node (the last), and doclink_md sent the references under both headings to the File node, since neither heading owned the shared node. A heading whose name repeats in the file now takes the names of the headings above it into its qualified name (`docs.repeated.Service-A.Implementation`). tree-sitter-markdown nests each heading's `section` in the section of the heading above it, so the chain is read from the tree. A heading whose name is unique in the file keeps its name alone, so no other Section is renamed. Headings that repeat under the same parents still share a name and keep the existing File fallback (doc_links_md_repeated_headings is unchanged). A heading text may hold dots, so a qualified name can equal another heading's name: `# Service-A.Implementation` against the qualified `## Implementation` under `# Service A`. All of a file's final names are therefore settled together, once per file on its first heading, in the scratch arena. A unique heading keeps its name, or else the first qualified one does, and every other qualified name in the collision takes the first free `~2`, `~3`, .... Names collide only when they come from different headings: the comparison is on the list of heading names, not on the dotted text. Diagrams find their Section through the definition list, so a diagram under a repeated heading now hangs off that heading's own Section. Tests (tests/test_doc_links_md.c): the document from the issue, with a Mermaid diagram under the second heading. Without the fix it fails on the defect: one `Implementation` Section where there are two. The same document plus `# Service-A.Implementation` requires five Sections, the unique heading keeping its name. Without the collision handling it fails with four. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Scott Beck <296871+bline@users.noreply.github.com>
bline
force-pushed
the
fix/doc-section-hierarchy
branch
from
October 14, 2026 22:14
0450ad6 to
9129898
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #2586. A Markdown Section's qualified name is the file's module plus
the heading text. So
## Implementationunder# Service Aand under# Service Bshared one qualified name. The graph kept one node (thelast), and the references under both headings went to the File node.
This changes Section qualified names, so please check the naming. A
heading whose name repeats in the file now has the names of the headings
above it in its qualified name:
# Service A…docs.repeated.Service-A## Implementation(under A)…docs.repeated.Implementation(shared)…docs.repeated.Service-A.Implementation## Implementation(under B)…docs.repeated.Implementation(shared)…docs.repeated.Service-B.Implementation## Notes(unique)…docs.repeated.NotesChoices I made, any of which I'm happy to change:
its file keeps its current qualified name, so existing queries and
stored names for those Sections still work. The cost is that adding a
second
## Implementationrenames the first. Qualifying every nestedheading would avoid that, but it would rename most Sections in every
indexed repository.
then fixed by the document's structure alone, with no ordinal that shifts
when a section is inserted above.
heading text may contain dots, so
# Service-A.Implementationwould getthe same name as the qualified
## Implementationunder# Service A.All final names in a file are settled together: a heading whose name is
unique keeps it, and a qualified name that collides takes the first free
~2,~3, …. (When only qualified names collide, the first in the filekeeps the name.) Names match only when their headings do. The comparison
is on the list of headings, not on the dotted text. The suffix appears
only in that collision.
## Fixesunder one# Changes) still share a name and keep the existing File fallback indoclink_md.c.doc_links_md_repeated_headingspins that and isunchanged.
namestays the heading text. Onlyqualified_namechanges.How. The parent headings come from the tree: tree-sitter-markdown nests
each heading's
sectioninside the section of the heading above it. Thefile's heading names are collected and sorted once per file, when the first
heading is seen. They are allocated in the scratch arena and held in a new
CBMExtractCtx.md_headingsslot, likedoc_memo. Diagrams find theirSection through the definition list, so a diagram under a repeated heading
now hangs off that heading's own Section.
This is Markdown only. reST and AsciiDoc sections are built elsewhere, and I
haven't checked whether they share the problem.
Evidence
doc_links_md_repeated_headings_by_parent_issue2586intests/test_doc_links_md.cindexes the document from the issue, with aMermaid diagram under the second
Implementation.doc_links_md_repeated_heading_name_collision_issue2586adds# Service-A.Implementationto that document and requires five Sections,with the unique heading keeping its name. Without the source change the first
test fails on the defect itself:
With it,
scripts/test.sh --suites doc_links_md,doc_links_rst,doc_links_adoc,doc_mentions,diagramsreports 115 passed, 0 failed.
Checklist
git commit -s) — required, CI rejectsunsigned commits (DCO, see CONTRIBUTING.md)
scripts/test.sh(the canonical leg), 9384 passed, 0 failed, 10 skipped,189 suites, Linux x86-64, gcc
scripts/lint.sh --ciintest-infrastructurelintcontainer(cppcheck + clang-format-20 + memory-core), "All linters passed"
Written with an AI agent (Claude); I reviewed the change and certify it via
the DCO sign-off.
🤖 Generated with Claude Code