Group consecutive inline images into a gallery - #2357
Open
Ruhdee wants to merge 6 commits into
Open
Conversation
Ruhdee
force-pushed
the
issue-2206
branch
3 times, most recently
from
July 9, 2026 16:17
452e0d7 to
3a178ae
Compare
Moves the aspect ratio based rendering code from `InlineImage` to the common `_Image` helper. Both image previews and inline images should be sized dynamically, based on their aspect ratio. See: zulip/zulip#39474
Image preview galleries now have spacing between images, and image previews have a thicker border, matching web. See: https://github.com/zulip/zulip/blob/0e259db4be1f0f089c533944034d1ce9d57c01d5/web/styles/rendered_markdown.css#L569-L571
Inline images now use web-matching padding, and the gray background is removed from them. On web that background is present only on gallery items and image previews, not standalone inline images. See: https://github.com/zulip/zulip/blob/0e259db4be1f0f089c533944034d1ce9d57c01d5/web/styles/rendered_markdown.css#L540-L561
Preparatory commit for gallerifying inline image nodes. 'MessageImageGallery' now takes a list of image nodes instead of a list node for generalization.
A run of inline images inside a paragraph separated only by <br> or whitespace is now grouped into an 'InlineImageNodeList' and rendered as a 'MessageImageGallery'. The run must be bounded by <br> or the start or end of the paragraph on both sides of the run. An image adjacent to non-whitespace text stays an individual InlineImageNode. Inline images are not put into galleries outside of paragraph contexts such as table cells, strong nodes and headings.
Collaborator
|
Thanks @Ruhdee for taking care of this. I am not very familiar with this part of the codebase, but with an overall skim and manual testing, LGTM. Marking for maintainer review. |
sm-sayedi
requested review from
rajveermalviya
and removed request for
sm-sayedi
July 28, 2026 19:01
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.
Fixes #2206.
Rebased on top of #2355.
Screenshots
This PR introduces "gallerifying" of inline images. The bugs and edge cases found in web #issues > 🎯 images not galleryifying @ 💬 are addressed by using a different approach from the one used in web (zulip/zulip#38324) for creating galleries.