Repository navigation
fix(workflow): keep a closed inner example exempt in an unclosed draft (#410) #411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -543,18 +543,32 @@ def issue_drafts(text): | |
| if "workflow:issue" in block: | ||
| if not closed: | ||
| # The draft's fence was never closed at document level, | ||
| # so a trailing bare fence line in the block was the | ||
| # so a trailing bare fence line in the block may be the | ||
| # draft's own closing fence, consumed as the embedded | ||
| # example's close (#401): drop it so draft_prose() sees | ||
| # the example as the unclosed one it is. | ||
| # example's close (#401): dropping it lets draft_prose() | ||
| # see that example as the unclosed one it is and recover | ||
| # the draft prose trapped inside it. But the same shape | ||
| # arises when the trailing fence is a properly closed | ||
| # example's genuine close and the example is simply the | ||
| # draft's last element (#410): dropping it there strips | ||
| # the closed example's exemption and link-checks its | ||
| # contents. The shapes are indistinguishable from the | ||
| # block alone, so drop the fence only when doing so is | ||
| # what surfaces the draft's own marker into the prose — | ||
| # i.e. the marker itself was trapped inside the example | ||
| # the fence appeared to close. | ||
| lines = block.splitlines() | ||
| found = ( | ||
| re.match(r"^ {0,3}(`{3,}|~{3,})\s*(.*?)\s*$", lines[-1]) | ||
| if lines | ||
| else None | ||
| ) | ||
| if found and not found[2]: | ||
| block = "\n".join(lines[:-1]) | ||
| dropped = "\n".join(lines[:-1]) | ||
| if "workflow:issue" not in draft_prose( | ||
| block | ||
| ) and "workflow:issue" in draft_prose(dropped): | ||
|
Comment on lines
+568
to
+570
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When draft prose mentions the literal Useful? React with 👍 / 👎. |
||
| block = dropped | ||
| # Nested fenced blocks inside a draft are embedded code | ||
| # examples, not draft prose: strip them whole (as | ||
| # unfenced() does at document level) so their contents are | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Match the issue marker, not a prose mention.
If draft prose mentions
workflow:issuebefore an unclosed inner example, this condition retains the trailing fence even when the actual<!-- workflow:issue ... -->marker is trapped after the example opening.draft_prose(block)then discards the trapped marker and any broken prose links with the example. Check for the actual marker syntax when deciding whether removal exposes it, and add a regression case with a prose mention before the unclosed example.🤖 Prompt for AI Agents