# markdown_preview: Open Markdown links in preview and scroll to linked headings and positions \(\#61784\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 1102219f812293a09da88eff1df95fbcedde6b09

Requested commit: 1102219f812293a09da88eff1df95fbcedde6b09

Commit: 1102219f812293a09da88eff1df95fbcedde6b09

Tree: 9767cd2a4206f02110631c850c7e1b69364fa766

Author: Smit Barmase

Committer: GitHub

## Message

```
markdown_preview: Open Markdown links in preview and scroll to linked headings and positions (#61784)

Closes #60985

Clicking a link to a Markdown file from a Markdown preview now opens the
target in a preview instead of the raw editor buffer. `alt`-click opens
the raw source editor instead.

- If there exists existing preview of that file it is reused. A link
back to the file being previewed navigates in place.
- `file.md#heading-slug` scrolls the preview to the linked heading.
- `file.md:42:5`, `file.md#L42` and `file.md#L42C5` open the preview
scrolled to that position with the cursor placed there. Non-Markdown
targets keep the existing behavior from #60864 (raw editor at the
position).

Added tests covering these and more cases.

Release Notes:

- Improved Markdown preview links: links to Markdown files now open in a
preview (scrolled to the linked heading or position) instead of the raw
file, and `alt`-click opens the raw source instead.
- Fixed GitHub-style `#L<line>C<column>` link fragments not placing the
cursor at the linked position.
```

## Parents

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

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