code_block
Create a fenced code block.
Syntax
1{{ value | code_block }}2{{ value | code_block:"typescript" }}Usage
- Use this filter to explicitly create a code block. The
codefilter 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.
Example
Open in Playground| Data | |
|---|---|
| Template | |
| Output | |