agent: Differentiate @mentions from markdown links (#28073)

This ensures that we display @mentions and normal markdown links
differently:

<img width="670" alt="Screenshot 2025-04-04 at 11 07 51"
src="https://github.com/user-attachments/assets/0a4d0881-abb9-42a8-b3fa-912cd6873ae0"
/>


Release Notes:

- N/A
This commit is contained in:
Bennet Bo Fenner 2025-04-04 11:39:48 +02:00 committed by GitHub
parent a7674d3edc
commit 1db3d92066
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 78 additions and 38 deletions

View file

@ -245,6 +245,17 @@ fn render_markdown(
}),
..Default::default()
},
link_callback: Some(Rc::new(move |url, cx| {
if MentionLink::is_valid(url) {
let colors = cx.theme().colors();
Some(TextStyleRefinement {
background_color: Some(colors.element_background),
..Default::default()
})
} else {
None
}
})),
..Default::default()
};
@ -320,6 +331,7 @@ fn open_markdown_link(
});
}
}),
Some(MentionLink::Fetch(url)) => cx.open_url(&url),
None => cx.open_url(&text),
}
}