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

MDBOOK009 - Playground Validation

Invalid {{#playground}} configuration.

Why This Rule Exists

The {{#playground}} directive creates interactive Rust code examples. Invalid paths or configuration cause build failures or non-functional playgrounds.

Examples

Incorrect

{{#playground missing-file.rs}}

{{#playground ../src/example.rs invalid_option}}

\{{playground src/demo.rs}}  <!-- Missing # -->

Correct

{{#playground ../src/example.rs}}

{{#playground ../src/example.rs editable}}

{{#playground ../src/example.rs editable hide_lines=1-3}}

Playground Options

<!-- Basic playground -->
{{#playground path/to/file.rs}}

<!-- Editable playground -->
{{#playground path/to/file.rs editable}}

<!-- Hide specific lines -->
{{#playground path/to/file.rs hide_lines=1-3}}

<!-- Multiple options -->
{{#playground path/to/file.rs editable no_run}}

Available Options

OptionDescription
editableAllow users to edit the code
no_runShow code but disable running
ignoreDon't test this code
hide_linesHide specific line ranges

Configuration

This rule has no configuration options.

Rule Details

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