getzola/zola

Missing error when using `extra_grammar` instead of `extra_grammars` in highlighting configuration

Open

#3127 opened on Mar 16, 2026

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Rust (15,349 stars) (1,046 forks)batch import
buggood first issue

Description

Description

When configuring syntax highlighting with a custom grammar, I accidentally used the incorrect field name extra_grammar (singular) instead of the correct extra_grammars (plural). Instead of getting an error about an unknown configuration field, Zola silently ignored the grammar and later reported that the language wasn't found, which was misleading and made debugging difficult.

Environment

· Zola version: 0.22.1 · OS: Arch Linux

Steps to reproduce

  1. Create a new Zola site:
    zola init test-site
    cd test-site
    
  2. Add a custom grammar file (e.g., pillar.json). For testing, you can use any valid syntax definition or even an empty file:
    mkdir -p static/grammar
    touch static/grammar/pillar.json
    
  3. Edit zola.toml with incorrect field name:
    [markdown.highlighting]
    error_on_missing_language = true
    style = "inline"
    theme = "tokyo-night"
    extra_grammar = [ "./static/grammar/pillar.json" ]  #  NOTE: Singular `extra_grammar`
    
  4. Create a content file with a code block using the custom language:
cat > content/test.md <<EOF
+++
title = "Test"
+++
   
\`\`\`pillar
some code
\`\`\`
EOF
  1. Run zola build

Expected behaviour

Either:

  • An error/warning about unknown configuration key extra_grammar, OR
  • An error that file coundn't be loaded due to invalid configuration

Actual Behavior

Building site...
ERROR Failed to build the site
ERROR Failed to render content of /workspace/test-site/content/test.md
ERROR Reason: Language `pillar` not found for syntax highlighting in "test.md".

Contributor guide