Repository navigation
feat(toc): Incremental Markdown AST Table of Contents & Anchor Slug Generator - #36
Merged
Merged
Conversation
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.
Bullet-Driven Engineering: Incremental Markdown AST Table of Contents & Anchor Slug Generator
Key Architectural Highlights
Markdown AST ATX Heading Extractor:
```and~~~) and HTML comments (<!-- ... -->).[text](url)), formatting characters (*,_,`), and trailing ATX hashes (##).Deterministic Slug Disambiguation:
slug,slug-1,slug-2).section) when headings contain empty or non-ASCII tokens.Hierarchical Node Tree & Stack Builder:
HeadingNodetree.Dual-Mode Rendering Engine:
render_markdown_toc: Emits nested indented Markdown lists with configurable depth bounds (min_level,max_level) and optional numbered bullets.render_html_toc: Generates semantic<nav class="toc">tags enclosing<ul>or<ol>elements with valid anchor tags (<a href="#slug">...</a>).Verification Matrix
test_slugify_heading_basics_and_unicode: Confirmed ASCII transformation, accent stripping, inline link stripping, and fallback handling.test_slugify_heading_collision_disambiguation: Verified sequential collision resolution (overview->overview-1->overview-2).test_parse_markdown_headings_atx_and_fences: Verified code fence immunity and HTML comment exclusion.test_build_heading_tree_hierarchy: Verified recursive tree structure and sibling grouping.test_render_markdown_toc_formatting: Verified level filtering (test_render_html_toc_semantic_nav: Verified semantic HTML tags and proper nesting.test_extract_table_of_contents_end_to_end: Verified end-to-end extraction from full document markdown.