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
This commit is contained in:
Óscar 2023-08-30 19:29:57 +02:00 committed by Vincent Prouillet
parent 8b2b066e64
commit 670b88263c

View File

@ -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);