Skip to content

Commit

Permalink
fix: suppress highlight language warnings if highlight_code is false (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
welpo authored Aug 30, 2023
1 parent e81e139 commit 674c433
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/markdown/src/codeblock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 674c433

Please sign in to comment.