Skip to content

Group consecutive inline images into a gallery - #2357

Open
Ruhdee wants to merge 6 commits into
zulip:mainfrom
Ruhdee:issue-2206
Open

Group consecutive inline images into a gallery#2357
Ruhdee wants to merge 6 commits into
zulip:mainfrom
Ruhdee:issue-2206

Conversation

@Ruhdee

@Ruhdee Ruhdee commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2206.

Rebased on top of #2355.

Screenshots

Before After
Old_light New_light
Old_dark New_dark

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.

@Ruhdee
Ruhdee force-pushed the issue-2206 branch 3 times, most recently from 452e0d7 to 3a178ae Compare July 9, 2026 16:17
Ruhdee added 3 commits July 11, 2026 10:42
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.
Ruhdee added 2 commits July 15, 2026 16:30
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.
@Ruhdee
Ruhdee marked this pull request as ready for review July 15, 2026 14:40
@Ruhdee Ruhdee added the mentor review GSoC mentor review needed. label Jul 15, 2026
@Ruhdee
Ruhdee requested a review from sm-sayedi July 15, 2026 14:41
@sm-sayedi

Copy link
Copy Markdown
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 sm-sayedi removed their assignment Jul 28, 2026
@sm-sayedi sm-sayedi added maintainer review PR ready for review by Zulip maintainers and removed mentor review GSoC mentor review needed. labels Jul 28, 2026
@sm-sayedi
sm-sayedi requested review from rajveermalviya and removed request for sm-sayedi July 28, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer review PR ready for review by Zulip maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gallerify "inline" images when set off by line breaks

3 participants