bug: images in articles have a huge gap above and below (spacing stacks three layers deep)
Back to our planSummary
Images inside articles have a huge empty gap above and below them (about 108px above, more below). It looks unbalanced and unfinished. The editor isn't at fault: the image block carries page-section spacing and the article text styles add their own on top, so the spaces pile up.
Problem
Reported by Amine on 2026-10-31 (Claude in Chrome side panel), on https://sprechereast.com/posts/wisdot-i39-corridor-hearings-2024, opens in a new tab: the paragraph "Milwaukee Street now ends near East Hill Parkway…" and the map image below it are far apart.
Measured on the live page, between that paragraph and the image:
| Source | Space |
|---|---|
Paragraph bottom margin (prose) | 20px |
MediaBlock wrapper py-10 md:py-14 (page-section padding) | 56px |
<picture> top margin (prose typography) | 32px |
| Total | ~108px |
The CMS content has no empty paragraphs or line breaks, so removing breaks in the editor would change nothing.
Cause: src/platform/richtext/MediaBlock.tsx is one component used in two places with different spacing needs.
- In the page builder it is its own section, so it needs section padding and a container.
- Inside rich text (posts and events) the article flow already spaces its children. Every other block there (
KeyFacts,Steps,Timeline,OutcomeFork,DiagramKey) opts out of the typography styles withnot-proseand sets one margin (my-8).MediaBlockdoes neither, so it stacks a second and third layer of spacing.
Proposed fix
Give MediaBlock one placement prop (section for the page builder, inline for rich text) instead of the separate enableGutter and disableInnerContainer flags. inline is not-prose my-8 with no section padding, matching the other rich-text blocks. Remove the unused breakout prop and the no-op col-span-3 col-start-1 and m-0 classes.
Native-first check: Tailwind Typography's own escape hatch is not-prose, which the other blocks already use; no plugin or new code needed.
Acceptance criteria
- Not done: On the post above, the gap between the paragraph and the image is about 32px, like the other blocks, at all six viewports (320 to 1920) in light and dark.
- Not done: The gap below an inline image is the same, and the Diagram key still sits snug under its image.
- Not done: A media block in the page builder looks exactly as before.
- Not done: Tests cover both placements.
- Not done: Parent: #163 (shared component library). The PR carries the
shared-componentlabel.
Generated by Claude Code, opens in a new tab