Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MDBOOK011 - Template Validation

Invalid {{#template}} syntax.

Why This Rule Exists

The {{#template}} directive expands templates with variable substitution. Invalid syntax or missing variables cause build failures.

Examples

Incorrect

{{#template missing-template.md}}

{{#template ./template.md var1=value}}  <!-- Missing closing -->

\{{template ./template.md}}  <!-- Missing # -->

Correct

{{#template ./templates/note.md}}

{{#template ./templates/warning.md title="Important" content="Read carefully"}}

Template Syntax

<!-- Basic template -->
{{#template path/to/template.md}}

<!-- With variables -->
{{#template path/to/template.md var1="value1" var2="value2"}}

Template File

<!-- templates/note.md -->
> **\{{title}}**
>
> \{{content}}

Usage

{{#template templates/note.md title="Note" content="This is important."}}

Configuration

This rule has no configuration options.

Rule Details

  • Rule ID: MDBOOK011
  • Aliases: template-validation
  • Category: MdBook
  • Severity: Warning
  • Stability: Experimental
  • Auto-fix: No