Skip to content

Check for local files from within surrounding parens#44733

Merged
KyleBarton merged 2 commits intomainfrom
allow_clickable_links_from_markdown_inline_18228
Dec 15, 2025
Merged

Check for local files from within surrounding parens#44733
KyleBarton merged 2 commits intomainfrom
allow_clickable_links_from_markdown_inline_18228

Conversation

@KyleBarton
Copy link
Collaborator

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:

Screen.Recording.2025-12-12.at.12.21.34.PM.mov

After:

Screen.Recording.2025-12-12.at.12.22.37.PM.mov

Release Notes:

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

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 12, 2025
@KyleBarton KyleBarton enabled auto-merge (squash) December 15, 2025 19:05
@KyleBarton KyleBarton merged commit c75d880 into main Dec 15, 2025
23 checks passed
@KyleBarton KyleBarton deleted the allow_clickable_links_from_markdown_inline_18228 branch December 15, 2025 19:27
CherryWorm pushed a commit to CherryWorm/zed that referenced this pull request Dec 16, 2025
…44733)

Closes zed-industries#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add clickable markdown local files links

1 participant