From e66a653ea9ba61d1d88f3af5b760c3671ff047e3 Mon Sep 17 00:00:00 2001 From: Cameron Clark Date: Sun, 15 Dec 2024 21:11:10 +0000 Subject: [PATCH] fix(blame): fix incorrect rendering of angle brakets in git blame tooltip This originally broke in f633b125b9bab98bc6d73432dd6e8f352cd7fcec, 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. --- crates/git/src/commit.rs | 2 +- crates/language/src/markdown.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/git/src/commit.rs b/crates/git/src/commit.rs index f32ad226af387..d06c38e7ad75c 100644 --- a/crates/git/src/commit.rs +++ b/crates/git/src/commit.rs @@ -32,7 +32,7 @@ pub fn get_messages(working_directory: &Path, shas: &[Oid]) -> Result", ">")), + .map(|str| String::from(str.trim())), ) .collect::>()) } diff --git a/crates/language/src/markdown.rs b/crates/language/src/markdown.rs index 0221f0f431bcc..1c9cec399eec0 100644 --- a/crates/language/src/markdown.rs +++ b/crates/language/src/markdown.rs @@ -306,6 +306,10 @@ pub async fn parse_markdown_block( Event::SoftBreak => text.push(' '), + Event::InlineHtml(inline_html) => { + text.push_str(&inline_html); + } + _ => {} } }