diff --git a/crates/markdown_preview/src/markdown_elements.rs b/crates/markdown_preview/src/markdown_elements.rs index 827c11f0453817b00431a1f32db8c645aced4e86..d0bde48889143b8ab9f66d9dc2839ebabf7d3541 100644 --- a/crates/markdown_preview/src/markdown_elements.rs +++ b/crates/markdown_preview/src/markdown_elements.rs @@ -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 { + pub fn to_highlight_style(&self, theme: &theme::SyntaxTheme) -> Option { 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) diff --git a/crates/markdown_preview/src/markdown_renderer.rs b/crates/markdown_preview/src/markdown_renderer.rs index 489ce532f0060d29436d008413be1391044ab3e3..6f794b1358a1869779b01f6af3069bf8be735e7e 100644 --- a/crates/markdown_preview/src/markdown_renderer.rs +++ b/crates/markdown_preview/src/markdown_renderer.rs @@ -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 }