Skip to content
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

Fix angle brackets not shown correctly in Git blame tooltip #22051

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

camc314
Copy link

@camc314 camc314 commented Dec 15, 2024

This originally broke in f633b12, this commit simply replaced < and > characters with their HTML encoded equivalents. While this worked, it was not correct for the case where < or > exist inside code blocks.

This also felt confusing that this was not happening where the markdown was being parsed, but rather where where the blame message was retrieved from git.

This commit fixes #22044, and should not cause a regression in #16220, by pushing any InlineHtml to the resulting string after parsing the markdown.

Closes #22044

Screenshot 2024-12-15 at 21 23 00 Screenshot 2024-12-15 at 21 22 43

Release Notes:

  • Fixed an issue where angle brackes would not be rendered correctly if nested inside a codeblock in git blame

…ltip

This originally broke in f633b12, this
commit simply replaced `<` and `>` characters with their HTML encoded
equivalents. While this worked, it was not correct for the case where
`<` or `>` exist inside code blocks.

This also felt confusing that this was not happening where the markdown
was being parsed, but rather where where the blame message was retrieved
from git.

This commit fixes zed-industries#22044, and **should not** cause a regression in
\zed-industries#16220, by pushing any `InlineHtml` to the resulting string after
parsing the markdown.

This comment was marked as resolved.

@maxdeviant maxdeviant changed the title fix(blame): angle brakets not shown correctly in git blame tooltip Fix angle brackets not shown correctly in Git blame tooltip Dec 15, 2024
@AlexJuca

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

@camc314

This comment was marked as resolved.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 16, 2024
Copy link

cla-bot bot commented Dec 16, 2024

The cla-bot has been summoned, and re-checked this pull request!

@cole-miller
Copy link
Contributor

Thanks for the PR! +1 to removing the special-case escaping of angle brackets. But we need a different approach for this inside the markdown parser, since emails in <> show up as Tag::Link not Event::Html, e.g. for this commit message

test

Line 1
Line 2

Signed-off-by: somebody <[email protected]>

we get

Start(Paragraph)
Text(Borrowed("test"))
End(Paragraph)
Start(Paragraph)
Text(Borrowed("Line 1"))
SoftBreak
Text(Borrowed("Line 2"))
End(Paragraph)
Start(Paragraph)
Text(Borrowed("Signed-off-by: somebody "))
Start(Link { link_type: Email, dest_url: Borrowed("[email protected]"), title: Borrowed(""), id: Borrowed("") })
Text(Borrowed("[email protected]"))
End(Link)
End(Paragraph)

So we just need to tweak the handling of Tag::Link when the LinkType is Email. Would you be up for revising this to use that approach?

@cole-miller cole-miller self-requested a review January 8, 2025 14:31
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.

incorrect display of git blame hover with angle brackets
3 participants