# Check for local files from within surrounding parens \(\#44733\) · gitcafe/zed

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

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

Visibility: public

Requested revision: c75d88098363cce524efeaf02e032dbb2719a3be

Requested commit: c75d88098363cce524efeaf02e032dbb2719a3be

Commit: c75d88098363cce524efeaf02e032dbb2719a3be

Tree: 002b3fb153c4eecd68af4e15c5b30786edef0ca5

Author: KyleBarton

Committer: GitHub

## Message

```
Check for local files from within surrounding parens (#44733)

Closes #18228

We parse local clickable links by looking for start/end based on
whitespace. However, this means that we don't catch links which are
embedded in parenthesis, such as in markdown syntax:
`[here's my link text](./path/to/file.txt)`

Parsing strictly against parenthesis can be problematic, because
strictly-speaking, files can have parenthesis. This is a valid file name
in at least MacOS:
`thisfilehas)parens.txt`

Therefore, this change adds a small regex layer on top of the filename
finding logic, which parses out text within parenthesis. If any are
found, they are checked for being a valid filepath. The original
filename string is also checked in order to preserve behavior.

Before:


https://github.com/user-attachments/assets/37f60335-e947-4879-9ca2-88a33f5781f5

After:



https://github.com/user-attachments/assets/bd10649e-ad74-43da-80f4-3e7fd56abd86



Release Notes:

- Improved link parsing for cases when a link is embedded in
parenthesis, e.g. markdown
```

## Parents

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

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