# editor: Fix Python docstring formatting in hover popovers \(\#59480\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/91ff38aee2cd774e49dc70c4d6a1a7a4b6c9d27b)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 91ff38aee2cd774e49dc70c4d6a1a7a4b6c9d27b

Requested commit: 91ff38aee2cd774e49dc70c4d6a1a7a4b6c9d27b

Commit: 91ff38aee2cd774e49dc70c4d6a1a7a4b6c9d27b

Tree: 91cc17a4bb04afb00c5aba4e7155a58372848459

Author: Darshan Sithan

Committer: GitHub

## Message

```
editor: Fix Python docstring formatting in hover popovers (#59480)

# Objective

Fixes #59426

Python (and possible others like JS/TS ) docstrings in hover popovers
currently have broken indentation and alignment. This happens because
markdown soft breaks (single newlines) are parsed and replaced with
spaces by default. This collapses multi-line Python docstrings into
single wraps, ruining code example layouts and line-wrapped formatting.

## Solution

Configure the `MarkdownStyle` returned by `hover_markdown_style` in
`crates/editor/src/hover_popover.rs` to treat soft breaks as hard breaks
(`soft_break_as_hard_break: true`). This ensures single newlines in
docstrings are preserved and rendered correctly in the hover popover.

## Testing

- Verified hover popovers locally on Python methods/classes to confirm
that multi-line docstring indentation and alignment are preserved.

## 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

---

Release Notes:

- Fixed Python and Markdown docstring formatting/alignment in hover
popovers.

---------

Co-authored-by: Martin Ye <martin@zed.dev>
```

## Parents

- [7e4caf003cad710c0fe5fbf99f70af5a3965c764](https://git.cafe/gitcafe/zed/commit/7e4caf003cad710c0fe5fbf99f70af5a3965c764?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/91ff38aee2cd774e49dc70c4d6a1a7a4b6c9d27b?format=markdown)
