# markdown: Add macOS lookup support for Markdown preview \(\#59297\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 5299a14401fdcf82a11d2af8117af1d77ef68441

Requested commit: 5299a14401fdcf82a11d2af8117af1d77ef68441

Commit: 5299a14401fdcf82a11d2af8117af1d77ef68441

Tree: 8ac1f258941044cec1d94fa67ad04d9ef42a967e

Author: Xiaobo Liu

Committer: GitHub

## Message

```
markdown: Add macOS lookup support for Markdown preview (#59297)

# Objective

Enable macOS three-finger Look Up / translation for rendered Markdown,
including Markdown Preview when it is the active focused item.

## Solution

- Register a read-only input handler for rendered Markdown when either
the Markdown view itself is focused or Markdown Preview provides the
active focus handle.
- Reuse the existing rendered Markdown text mapping for visible text
extraction, hit testing, and bounds calculation.
- Add UTF-16 range conversion so AppKit lookup requests map correctly
between macOS text ranges and Markdown source ranges, including CJK text
and emoji.

Release Notes:

- Improved Markdown Preview by supporting macOS Look Up / translation
gestures when focused.

---------

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
```

## Parents

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

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