# markdown_preview: Open relative links at line \(\#60864\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 4a1df1f7ca80e59f8cff48d3d1eb10bae4d3bc25

Requested commit: 4a1df1f7ca80e59f8cff48d3d1eb10bae4d3bc25

Commit: 4a1df1f7ca80e59f8cff48d3d1eb10bae4d3bc25

Tree: 814e301c9a5d60d019ce846d4be42d36231accf3

Author: Kevin Bravo

Committer: GitHub

## Message

```
markdown_preview: Open relative links at line (#60864)

Closes #60733

# Objective

Markdown Preview treats a relative `path:line[:column]` destination as a
literal filename. When that file does not exist, the link falls through
to the system URL handler instead of opening the workspace file at the
requested position.

## Solution

- Recognize position suffixes on relative Markdown links.
- Convert GitHub-style `#L42` fragments into the same positioned target
used by `path:42`, so both forms share one resolution and opening path.
- Resolve links with `workspace::path_link::possible_open_target` using
the Markdown source directory. This keeps the remote-project path
resolution added in #61438.
- Open resolved targets with `editor::items::open_resolved_target`,
including its one-based row and column handling.
- Preserve valid URI schemes and fall back to the existing Markdown link
behavior when no workspace target resolves.

## Testing

- Extended the Markdown Preview GPUI regression test to cover relative
`path:line:column`, GitHub-style `#Lline`, subfolder-relative
resolution, and custom URI schemes.
- `git diff --check` passes.
- The focused Rust test could not start in the current macOS environment
because the Rust toolchain binaries hang in the dynamic loader before
Cargo runs. PR Actions are awaiting maintainer approval.

## Self-Review Checklist:

- [x] I have reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed UI and icon guidelines
- [x] Tests cover the new and changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed Markdown Preview links using workspace-relative paths with line
and column suffixes.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
```

## Parents

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

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