fix: fold stacked image size comments - #455
Conversation
An image followed by a sizing magic comment folds that comment into the
image mark so it round-trips as source while supplying the width — but
only for a standalone image. Inside a link label
(`[<!-- {"width":N} -->](target)`) the comment was emitted
as plain visible text instead, leaking raw markup into the rendering.
Thread takeMagicComment through walkResolvedLink's image call site, the
same folding the standalone-image path already does, and extract the
per-child dispatch into walkResolvedLinkChild to stay within the
statement limit.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughLinked-image handling now uses shared atom traversal and supports consecutive magic-comment folding. Tests cover resizing, parsing, link-label behavior, comment placement, and rendered image width. ChangesLinked image metadata handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
commit: |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
An image now folds the whole run of magic comments chained behind it (first one wins) and
stripMagicCommentdrops the whole run, so documents where an unfolded rewrite once stacked a second comment render clean and collapse back to a single comment on the next resize.walkandwalkResolvedLinknow share onewalkAtomChilddispatch so atom handling cannot drift between the top level and a link label again; adds parser, resize round-trip, andMarkdownViewcoverage for linked images.Summary by CodeRabbit