Escape quotes in MarkdownRenderer link and image titles#459
Merged
lepture merged 1 commit intoJun 27, 2026
Merged
Conversation
A title containing a double quote was emitted unescaped inside double quotes, e.g. [t](/u 'a"b') re-rendered as [t](/u "a"b"). On a re-parse the embedded quote closes the title early, so the title is silently dropped (or the link fails to parse). Escape backslashes and the closing quote when writing inline-link, image and reference-link titles so they survive a round trip.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #459 +/- ##
=======================================
Coverage 91.04% 91.05%
=======================================
Files 34 34
Lines 3407 3409 +2
Branches 672 672
=======================================
+ Hits 3102 3104 +2
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:
|
|
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.



The
MarkdownRendererwraps link and image titles in double quotes but never escapes a quote inside the title, so a title containing one round-trips into broken Markdown:Re-parsing that output closes the title at the embedded quote, so the title is silently dropped and the link can fail to parse. Reference-link titles (in
render_referrences) and image titles hit the same thing.I escape backslashes and then the closing quote before writing the title, the same way the renderer already keeps other special characters literal (codespan backticks, leading block markers). Added a round-trip test covering inline links, images and reference links, plus a title mixing a backslash with a quote.