Fix/exclude validation in code block comments#27
Conversation
Fixed an issue where 4 or more backticks (````) used to wrap markdown code blocks were not properly handled, causing CODE_REF comments inside these blocks to be incorrectly validated. The previous implementation only detected triple backticks (```), which matched the first 3 characters of longer sequences like ````, leading to incorrect pairing and false positives. New implementation: - Detects all backtick sequences of 3 or more characters - Records both position and length of each sequence - Pairs sequences only if they have matching lengths - Supports arbitrary nesting levels (````, ``````, etc.) Test cases added: - 4-backtick code blocks containing 3-backtick blocks - 5-backtick code blocks with nested structures - Unclosed blocks with variable-length sequences All tests pass (17 test suites, 374 tests). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Pull Request ReviewSummaryThis PR fixes a bug where CODE_REF comments inside markdown code blocks with 4+ backticks were incorrectly validated. The new implementation properly handles variable-length backtick sequences by pairing sequences with matching lengths. ✅ Strengths1. Well-Designed AlgorithmThe length-based pairing algorithm in getCodeBlockRanges() (src/core/validate.ts:53-129) is elegant and correctly handles:
2. Comprehensive Test CoverageThe new tests (src/core/validate.test.ts:246-290) cover:
3. Good DocumentationThe architecture documentation (docs/architecture/overview.md:17-51) clearly explains the algorithm and its behavior. 4. Code Style Compliance
|
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 0.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
No description provided.