code_block

Create a fenced code block.

View Markdown

Syntax

{{ value | code_block }}{{ value | code_block:"typescript" }}

Usage

  • Use this filter to explicitly create a code block. The code filter defaults to inline code using backticks, and automatically creates a fenced code block for multiline values or when a language is specified.
  • The optional language is added after the opening fence.
  • For arrays and objects, including serialized collections from another filter, string values are formatted recursively while keys and non-string values are preserved.