From 670b88263cf2cae3b03c6966b68e992ff4258cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar?= Date: Wed, 30 Aug 2023 19:29:57 +0200 Subject: [PATCH] fix: suppress highlight language warnings if highlight_code is false (#2287) The warning about unknown highlight languages was displayed even when code highlighting was disabled via `markdown.highlight_code = false`. This commit adds a condition to check this setting before issuing the warning, effectively suppressing it when code highlighting is disabled. Issue: #2280 --- components/markdown/src/codeblock/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/markdown/src/codeblock/mod.rs b/components/markdown/src/codeblock/mod.rs index 01af5f01..5e297926 100644 --- a/components/markdown/src/codeblock/mod.rs +++ b/components/markdown/src/codeblock/mod.rs @@ -77,7 +77,7 @@ impl<'config> CodeBlock<'config> { path: Option<&'config str>, ) -> (Self, String) { let syntax_and_theme = resolve_syntax_and_theme(fence.language, config); - if syntax_and_theme.source == HighlightSource::NotFound { + if syntax_and_theme.source == HighlightSource::NotFound && config.markdown.highlight_code { let lang = fence.language.unwrap(); if let Some(p) = path { eprintln!("Warning: Highlight language {} not found in {}", lang, p);