@@ -1,5 +1,5 @@
use gpui::{
- DefiniteLength, FontStyle, FontWeight, HighlightStyle, Hsla, SharedString, StrikethroughStyle,
+ DefiniteLength, FontStyle, FontWeight, HighlightStyle, SharedString, StrikethroughStyle,
UnderlineStyle, px,
};
use language::HighlightId;
@@ -175,11 +175,7 @@ pub enum MarkdownHighlight {
impl MarkdownHighlight {
/// Converts this [`MarkdownHighlight`] to a [`HighlightStyle`].
- pub fn to_highlight_style(
- &self,
- theme: &theme::SyntaxTheme,
- link_color: Hsla,
- ) -> Option<HighlightStyle> {
+ pub fn to_highlight_style(&self, theme: &theme::SyntaxTheme) -> Option<HighlightStyle> {
match self {
MarkdownHighlight::Style(style) => {
let mut highlight = HighlightStyle::default();
@@ -209,10 +205,8 @@ impl MarkdownHighlight {
if style.link {
highlight.underline = Some(UnderlineStyle {
thickness: px(1.),
- color: Some(link_color),
..Default::default()
});
- highlight.color = Some(link_color);
}
Some(highlight)
@@ -692,7 +692,7 @@ fn render_markdown_text(parsed_new: &MarkdownParagraph, cx: &mut RenderContext)
let highlights = gpui::combine_highlights(
parsed.highlights.iter().filter_map(|(range, highlight)| {
highlight
- .to_highlight_style(&syntax_theme, link_color)
+ .to_highlight_style(&syntax_theme)
.map(|style| (range.clone(), style))
}),
parsed.regions.iter().zip(&parsed.region_ranges).filter_map(
@@ -705,6 +705,14 @@ fn render_markdown_text(parsed_new: &MarkdownParagraph, cx: &mut RenderContext)
..Default::default()
},
))
+ } else if region.link.is_some() {
+ Some((
+ range.clone(),
+ HighlightStyle {
+ color: Some(link_color),
+ ..Default::default()
+ },
+ ))
} else {
None
}