Keep a trailing ">" when reformatting block quotes#460
Merged
lepture merged 1 commit intoJun 28, 2026
Merged
Conversation
MarkdownRenderer.block_quote indented every line with '> ' (including the
blank line a paragraph leaves behind) and then ran rstrip('> \n') to drop
that dangling marker. Because rstrip strips a character set, it also ate a
'>' that ended the quote's own content, so an autolink, an inline HTML tag,
or a literal '>' lost its final character (e.g. '> <https://x.com>' became
'> <https://x.com', which reparses as escaped text).
Strip the children's trailing blank lines before indenting instead, so the
marker is never added to an empty trailing line and there is nothing to peel
back off.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #460 +/- ##
=======================================
Coverage 91.05% 91.05%
=======================================
Files 34 34
Lines 3409 3409
Branches 672 672
=======================================
Hits 3104 3104
Misses 184 184
Partials 121 121
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
lepture
approved these changes
Jun 28, 2026
|
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.



Reformatting a block quote through
MarkdownRendererdrops the last>of its content, so an autolink, an inline HTML tag, or a literal>comes out broken:block_quoteindents every line with>(including the blank line a paragraph leaves at the end) and then callsrstrip("> \n")to remove that dangling marker. Sincerstripstrips a character set, it also peels off a>that ends the content itself, so the reparse turns<https://example.com>into escaped text.I strip the children's trailing blank lines before indenting, so the marker is never added to an empty trailing line and there's nothing to strip back off. Existing empty-line-inside-quote handling is unchanged.
Added round-trip cases for content ending in
>(autolink, HTML tag, literal>, nested quote). Full test suite andmypy --strictpass.