# markdown_preview: Show link destinations on hover \(\#60942\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 3bd398582fa0974243d7d466fe6f505958a9ae35

Requested commit: 3bd398582fa0974243d7d466fe6f505958a9ae35

Commit: 3bd398582fa0974243d7d466fe6f505958a9ae35

Tree: 54e8453d4553cf512285f26c9079b882d3764e49

Author: Warya Wayne

Committer: GitHub

## Message

```
markdown_preview: Show link destinations on hover (#60942)

# Objective

Markdown Preview does not reveal where a link will navigate before it is
opened or right clicked to copy the URL.

Show a small Firefox-style URL preview in the bottom-left corner when
hovering text links or linked images.

## Solution

- Added URL hover reporting to the Markdown renderer, including hit
detection for linked images that are outside the text layout.
- Used the existing `LinkPreview` component to display the hovered
destination in the bottom-left corner of the Markdown preview.
- Cleared the destination preview when the pointer leaves a link, the
preview, or the displayed Markdown changes.

## Testing

- Confirmed the project builds successfully and manually verified the
behavior on macOS.
- Hovered text links and linked images in a Markdown preview and
confirmed their destinations appear in the bottom-left corner.
- Moved the pointer away from links and outside the preview and
confirmed the destination preview disappears.
- Reviewers can test this by opening a Markdown file containing a text
link and a linked image, opening its preview, and hovering each link.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] 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

See bottom left of this image for a sample of the link preview in
action.

<img width="2240" height="1258"
alt="warya_wayne_fix_markdown_render_link_preview_zed_pr"
src="https://github.com/user-attachments/assets/7659e2ae-161d-4a41-a5b4-ba5b76951e30"
/>


---

Release Notes:

- Improved Markdown previews by showing link destinations in the
bottom-left corner when hovering links.
```

## Parents

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

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