---
title: math_block
description: "Create a block math expression."
---

# math_block

Create a block math expression.

## Syntax

```knap
{{ value | math_block }}
```

## Usage

- Use this filter to explicitly create a math block. The `math` filter defaults to inline math using a single `$`, and automatically uses `$$` block fences for multiline values.
- For arrays and objects, including serialized collections from another filter, string values are formatted recursively while keys and non-string values are preserved.

## Example

```json title="Data"
{
  "expression": "x^2 + y^2"
}
```

```knap title="Template"
{{ expression | math_block }}
```

```md title="Output"
$$
x^2 + y^2
$$
```

## Related filters

- [math](/filters/math)
