From dabc614fb393f51c6f4fc4cb6c4ca0e39a54ccd8 Mon Sep 17 00:00:00 2001 From: C Jones Date: Sun, 9 Sep 2018 16:02:38 -0400 Subject: [PATCH] Change highlighting to not include duplicated background colors --- components/rendering/src/markdown.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/rendering/src/markdown.rs b/components/rendering/src/markdown.rs index e7468db..9a9095b 100644 --- a/components/rendering/src/markdown.rs +++ b/components/rendering/src/markdown.rs @@ -51,6 +51,7 @@ pub fn markdown_to_html(content: &str, context: &RenderContext) -> Result = None; // If we get text in header, we need to insert the id and a anchor let mut in_header = false; @@ -93,7 +94,7 @@ pub fn markdown_to_html(content: &str, context: &RenderContext) -> Result Result highlighter = Some(h), + Ok(h) => { + highlighter = Some(h); + // This selects the background color the same way that start_coloured_html_snippet does + let color = theme.settings.background.unwrap_or(::syntect::highlighting::Color::WHITE); + background = IncludeBackground::IfDifferent(color); + } Err(err) => { error = Some(format!("Could not load syntax: {}", err).into()); return Event::Html(Borrowed(""));