Skip to content

Exclude fenced code headings from documentation navigation - #63

Merged
LunaStev merged 1 commit into
wavefnd:masterfrom
sjh9714:codex/20260923-45-docs-fences
Sep 23, 2026
Merged

LunaStev merged 1 commit into
wavefnd:masterfrom
sjh9714:codex/20260923-45-docs-fences

Conversation

@sjh9714

@sjh9714 sjh9714 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #45.

Headings inside tilde-fenced examples appeared in the documentation table of contents. Shorter backtick fences could also end a block prematurely, adding false entries or hiding later headings.

Changes

  • Track the opening fence character and length, and close only on a matching fence of sufficient length with no trailing text.
  • Add regression coverage for both fence styles, language tags, misleading delimiters, indentation, and Unicode duplicate anchors before and after code blocks.

Testing

  • go test ./internal/document -run TestMarkdownHeadingsExcludeFencedCode -count=1 -v
  • go test ./...
  • go vet ./...
  • PATH=/tmp/node-v24.21.0-darwin-arm64/bin:$PATH make test build

Verified locally on macOS/arm64 with Go 1.26.3 and Node 24.21.0. The 11 regression fixtures also produce matching headings and anchors with the frontend's Markdown renderer.

@LunaStev LunaStev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for your contribution!

@LunaStev
LunaStev merged commit d0c2b6f into wavefnd:master Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exclude headings inside tilde-fenced code from the documentation table of contents

2 participants