markdown_preview: Add font size settings and actions (#55489)

Add support for scaling the Markdown preview's body text and headings
with `cmd-=` / `cmd--` / `cmd-0`. Previously these shortcuts only
resized code blocks because the preview's body used `ui_font_size` and
headings used a rem-based scale anchored to it, while the keybindings
only mutated `BufferFontSize`.

The preview's scroll subtree is now wrapped in
`WithRemSize(buffer_font_size)`, so `1rem` resolves to the buffer font
size inside the preview. Body text, headings
(`text_3xl`/`text_2xl`/...), and rem-based spacing all scale together.
The outer focus root and scrollbar remain at the UI font size.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #55374

Release Notes:

- Added `markdown_preview_font_size` setting and actions to scale
Markdown preview font size separately from the editor.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
This commit is contained in:
David AlecrimandSmit Barmase authored and GitHub committed 2026-06-26 05:12:59 +00:00
1 parent 35eaeb94a7
commit 46ff888db8
9 files changed
+349 -47

No files matched your search

+11 -1
View File
@@ -71,7 +71,17 @@ If you would like to use distinct themes for light mode/dark mode that can be se
"agent_ui_font_size": 15,
// Controls the font size for the agent panel's message editor, user message,
// and any other snippet of code.
"agent_buffer_font_size": 12
"agent_buffer_font_size": 12,
// Controls the font size for the markdown preview.
// If not specified, it falls back to the editor font size.
"markdown_preview_font_size": null,
// Controls the font family for the markdown preview.
// If not specified, it falls back to the UI font family.
"markdown_preview_font_family": null,
// Controls the font family for code blocks in the markdown preview.
// If not specified, it falls back to the editor font family.
"markdown_preview_code_font_family": null
```
### Font ligatures