fix(markers): never pair a marker with an example in closed code - #712
Conversation
A marker whose name misses a section by a letter, and a README with no section markers at all, both produced a successful run that generated nothing, with the reason logged at debug level only. Before any section is written, generate now warns about a marker whose name is within two edits of a section name, suggesting that section, and about a README with no marker for any section, pointing at README.example.md. A name far from every section is left alone: the template's own [.github/ghadocs/examples/] marker and other tools' markers use the same syntax. Markers inside code are examples and are not reported. The exit code is unchanged. Fixes #644 Fixes #641 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
The mistyped-marker check set aside every marker inside code, so a single mistyped pair after an unclosed generated fence went unreported. It now follows locateSection's rule: a single pair counts wherever it sits, and code only sets aside markers that are not one pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
A typo on one side splits a pair across two names, so the pair rule saw neither side as a pair and set the typo aside when it sat after an unclosed fence. Markers are now grouped by their section, or the section a near-miss name was meant to be, before the pair rule is applied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
The mistyped-marker check used the single-pair rule as a stand-in for "the markers sit after an unclosed fence", and each edge case of that stand-in produced a missed or false warning. It now asks the real question: a marker inside closed code is an example, and a marker inside a fence that nothing closes is reported. The missing-markers warning now checks the sections being generated, so --sections=inputs against a README with only a title pair warns, and an empty selection does not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
A section with one start marker and one end marker was located wherever the pair sat, even when one side was an example in a later code block. The tool then replaced everything between the real start marker and the example, including the user's prose. A marker inside closed code (inline code, an indented block, or a fence its closing fence ends) is now always an example. A marker inside a fence that nothing closes still counts, so such a fence cannot hide the markers after it. The mistyped-marker check and the contract verifier read markers the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
|
Warning Review limit reachedNext included review available in 31 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: bitflight-devops/github-action-readme-generator/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
The unclosed-fence check read a code range's kind from its text, so inline code opened by triple backticks, or an indented block whose first line is backticks, was taken for a fence that nothing closes, and a mistyped example inside it was reported. The parser's node kind now decides: only a fenced code block, whose node starts at its fence, can be unclosed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
…ude/closed-code-examples # Conflicts: # src/markers.ts
Only fenced code blocks reach isUnclosedFence, and a fenced block's node starts at its fence, so the branch for a missing opener could not run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
…ude/closed-code-examples # Conflicts: # src/markers.ts
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…amples # Conflicts: # src/markers.ts
## [2.0.3](v2.0.2...v2.0.3) (2026-09-29) ### Bug Fixes * **markers:** never pair a marker with an example in closed code ([#712](#712)) ([44f4da7](44f4da7)) * **readme-generator:** warn about mistyped and missing section markers ([#708](#708)) ([7d6c536](7d6c536)) * **sections:** keep fenced code blocks in a description intact ([#709](#709)) ([47728d4](47728d4))
|
🎉 This PR is included in version 2.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
This PR is stacked on #708, because it reuses #708's unclosed-fence check. Once #708 merges, it retargets to
main.locateSectionused a section's one start marker and one end marker wherever the pair sat, even when one side was an example in a later code block. Take a README with one real<!-- start inputs -->, where the only<!-- end inputs -->is inside a fenced example further down. The tool replaced everything between them, including the user's prose and the fence opener.mainbehaved the same before #704.Type of Change
Related Issues
Changes Made
diagnoseMarkersandscripts/verify-readme-contract.mjsread markers the same way. The verifier has its own implementation.docs/tool-contract.mdstates the new rule.Testing
vp test,vp check, bundled-binary test, markdownlint)unpaired.missing.🤖 Generated with Claude Code
https://claude.ai/code/session_01H37LVnd9qB6PmZ5bJi5H2t
Generated by Claude Code