-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
markdown: Add support for HTML href elements
#42265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bennetbo
merged 4 commits into
zed-industries:main
from
RemcoSmitsDev:add-markdown-href-support
Nov 13, 2025
Merged
markdown: Add support for HTML href elements
#42265
bennetbo
merged 4 commits into
zed-industries:main
from
RemcoSmitsDev:add-markdown-href-support
Nov 13, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
@bennetbo It's ready for your review. |
bennetbo
reviewed
Nov 11, 2025
f8bb370 to
9031a9d
Compare
Member
|
Pushed a small change that removes a bunch of |
bennetbo
approved these changes
Nov 12, 2025
11happy
pushed a commit
to 11happy/zed
that referenced
this pull request
Dec 1, 2025
This PR adds support for `HTML` href elements. It also refactored the way we stored the regions, this was done because otherwise I had to add 2 extra arguments to each `HTML` parser method. It's now also more inline with how we have done it for the highlights. **Small note**: the markdown parser only supports HTML href tags inside a paragraph tag. So adding them as a root node will result in just showing the inner text. This is a limitation of the markdown parser we use itself. **Before** <img width="935" height="174" alt="Screenshot 2025-11-08 at 15 40 28" src="https://github.com/user-attachments/assets/42172222-ed49-4a4b-8957-a46330e54c69" /> **After** <img width="1026" height="180" alt="Screenshot 2025-11-08 at 15 29 55" src="https://github.com/user-attachments/assets/9e139c2d-d43a-4952-8d1f-15eb92966241" /> **Example code** ```markdown <p>asd <a href="https://example.com">Link Text</a> more text</p> <p><a href="https://example.com">Link Text</a></p> [Duck Duck Go](https://duckduckgo.com) ``` **TODO**: - [x] Add tests cc @bennetbo Release Notes: - Markdown Preview: Add support for `HTML` href elements. --------- Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
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
community champion
Issues filed by our amazing community champions! 🫶
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for
HTMLhref elements. It also refactored the way we stored the regions, this was done because otherwise I had to add 2 extra arguments to eachHTMLparser method. It's now also more inline with how we have done it for the highlights.Small note: the markdown parser only supports HTML href tags inside a paragraph tag. So adding them as a root node will result in just showing the inner text. This is a limitation of the markdown parser we use itself.
Before

After

Example code
TODO:
cc @bennetbo
Release Notes:
HTMLhref elements.