Constrain blog images on desktop to improve reading rhythm#2651
Constrain blog images on desktop to improve reading rhythm#2651google-labs-jules[bot] wants to merge 4 commits into
Conversation
Constrain inline markdown images and Mermaid diagrams in blog posts to a maximum width of 2xl on desktop viewports. This prevents oversized images from disrupting the reading rhythm. - Added responsive maxWidth and maxHeight to standard img renderer - Added responsive maxWidth and maxHeight to Mermaid diagram renderer - Used design system primitives (Box) and responsive props - Verified with Playwright screenshots and smoke tests
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
🚀 Deployment Details (Last updated: Jun 19, 2026, 3:05 PM PST) 🚀 Pushed to gh-pages; publish in progress
|
🐙 GitHub Models Code Review
Reviewing: PR #2651 Model: gpt-4.1 Code Review FeedbackReview of src/components/ui/MarkdownRenderer.tsx Confirming Previous Findingsfinding-1: Responsive objects passed to native img element
finding-2: Passing height="auto" to native img
New IssuesI have carefully reviewed the diff for new, high-severity issues. 1. Chakra Box props: maxWidth and maxHeight values
2. img element: className and props
3. Mermaid diagram rendering
4. Types
5. Performance
6. Security
Final VerdictAll previously raised blocking issues are resolved. No new blocking issues are introduced by this diff. Structured JSON summary: { "findings": [ { "id": "finding-1", "file": "src/components/ui/MarkdownRenderer.tsx", "line": 151, "snippet": "maxWidth={{ base: \"full\", md: \"2xl\" }}", "issue": "Passing responsive objects as values to maxWidth and maxHeight on a Box rendered as img is invalid; native img elements do not accept these props and will ignore them.", "status": "resolved", "fixSummary": "Responsive constraints are now applied to a parent Box, and the native img element receives only valid HTML attributes." }, { "id": "finding-2", "file": "src/components/ui/MarkdownRenderer.tsx", "line": 153, "snippet": "height=\"auto\"", "issue": "Passing height=\"auto\" to a native img element is invalid; img expects a numeric value or string representing a number.", "status": "resolved", "fixSummary": "height=\"auto\" is removed from the img element; aspect ratio is preserved using Tailwind className." } ] }[VERDICT: PASS] Generated by github-models-code-review |
- Wrap markdown images and Mermaid diagrams in a Box primitive to enforce desktop sizing. - Limit image maxWidth to 2xl and maxHeight to 128 on desktop viewports. - Maintain full width and responsive scaling on mobile. - Ensure design system compliance by avoiding as="img" with responsive props.
🐙 GitHub Models Visual Review
Summary: 🔴 2 high · 🟡 0 medium · 🟢 0 low 🔴
|
- Wrap images and mermaid diagrams in a Box primitive with responsive constraints - Set maxWidth to '2xl' and maxHeight to '96' (approx. 384px) on desktop viewports - Use max-w-full and max-h-full on inner img tags to prevent stretching small assets - Maintain full-width scaling on mobile viewports - Ensure image corner rounding and shadows align with the design system This change prevents oversized images from breaking the desktop reading rhythm while maintaining responsive behavior on smaller screens.
|
🤖 AI Technical AuditANTI-AI-SLOPThe refactoring of the image rendering logic into a wrapper-child pattern introduces unnecessary DOM bloat. The use of an additional FINAL RECOMMENDATIONApproved with Minor Changes Review automatically published via RepoAuditor. |
- Refactored image and Mermaid diagram renderers to use 'Box as="img"' - Applied responsive maxWidth (2xl) and maxHeight (80) directly to image elements - Removed unnecessary wrapper Boxes to satisfy technical audit regarding DOM bloat - Added required classes to Tailwind safelist for production build - Maintained aspect ratio and centering across all viewports This update addresses PR feedback while preserving the fix for oversized desktop images.
Problem Statement
The current implementation does not constrain the sizing of inline markdown images and Mermaid diagrams within the blog post body on desktop viewports, leading to potential layout issues.
Goal
To constrain the sizing of inline markdown images and Mermaid diagrams in the blog post body on desktop viewports while ensuring they maintain their aspect ratio and adhere to design system guidelines.
Non-Goals
None.
Proposed Approach
src/components/ui/MarkdownRenderer.tsxto use responsivemaxWidth={{ base: "full", md: "2xl" }}andmaxHeightfor standard images and Mermaid diagrams.className="object-contain".Alternatives Considered
None.
Architectural Impact
None.
Scope
This change will impact the Markdown renderer used for displaying blog posts and research studies, specifically focusing on the layout of images and diagrams in desktop viewports.
UNDERSTAND THE ISSUE
The issue arises from the lack of constraints on the sizing of inline markdown images and Mermaid diagrams, potentially leading to inappropriate scaling and layout discrepancies in the blog post presentation.
DETERMINE APPROACH
The approach involves modifying the Markdown renderer component to include responsive design constraints for images and diagrams, ensuring compliance with design standards and maintaining visual integrity across different devices.
SPECIFY SCOPE
The scope is limited to the
src/components/ui/MarkdownRenderer.tsxfile and the styling related to inline markdown images and Mermaid diagrams within the blog post body. Verification will include checking for desktop viewports and ensuring that mobile viewports remain at full width.DEFINITION OF DONE
src/components/ui/MarkdownRenderer.tsx.maxWidthandmaxHeight.className="object-contain".pnpm run auditandpnpm run ci:localare executed without introducing anti-patterns or regressions.