# Objective - Fixes #62528 - Code blocks in rendered markdown ignored the `buffer_line_height` setting. With the line height left unset, they fell back to the ambient default of ~1.618, so the same code was spaced more loosely in markdown than it was in an editor or the terminal. - The extra leading is most obvious with box-drawing characters — the ASCII-art box from the issue renders as disconnected stripes instead of continuous vertical rules. - The issue also notes that the preview font "seems bigger". That part is working as intended and is not changed here: preview code blocks size from `markdown_preview_font_size`, which falls back to `ui_font_size` rather than `buffer_font_size` so that temporary UI zoom doesn't resize the preview. Users who want it to match the editor can set `markdown_preview_font_size` explicitly. ## Solution - Set `line_height` on the code block text style in `MarkdownStyle::themed_with_overrides`, derived from `theme_settings.buffer_line_height`. - The value is `relative(...)` rather than absolute pixels so it tracks the code font size, which some callers override after building the style (e.g. the agent panel sets `code_block.text.font_size` downstream). An absolute value computed from the theme's font size would be wrong for those callers. - Scope: this applies to every `MarkdownFont` variant — preview, agent panel, and editor — since the code block style is shared and `with_preview_overrides` doesn't touch line height. - Prose leading is deliberately unchanged. It stays a per-element typographic choice, independent of the buffer setting. ## Testing - `cargo test -p markdown` — 145 passed, 0 failed. - Added `test_code_block_line_height_follows_buffer_line_height_setting`: renders a paragraph plus a fenced code block at `buffer_line_height` 1.2 and 1.8, asserts the code block's rendered line height tracks the setting, and asserts prose leading does *not* move. - Added `test_code_block_line_height_tracks_overridden_code_font_size`: overrides `code_block.text.font_size` after building the style and asserts the line height follows the override. This is what pins the `relative` vs. absolute choice. - To reproduce manually, set `"buffer_line_height": { "custom": 1.2 }` and open a markdown preview containing the ASCII-art box from #62528. The vertical rules should join into continuous lines, matching how the same block renders in an editor, and should visibly separate again at `"comfortable"`. ## 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 adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Showcase Before <img width="927" height="912" alt="Screenshot 2026-08-17 at 5 06 41 PM" src="https://github.com/user-attachments/assets/be6213bf-f3aa-42fb-8784-1985b5379d74" /> After <img width="915" height="994" alt="Screenshot 2026-08-17 at 5 06 54 PM" src="https://github.com/user-attachments/assets/c9c7f395-50cb-437b-a423-2030da88e4f4" /> --- Release Notes: - Fixed markdown code blocks not respecting the `buffer_line_height` setting
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).
Other platforms are not yet available:
- Web (tracking discussion)
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Sponsorship
Zed is developed by Zed Industries, Inc., a for-profit company.
If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.