﻿---
title: curb_razor_format_markup
description: Experimental. With curb_razor_format_code_blocks, also re-indent markup by its nesting, as Microsoft's Razor formatter does. Only indentation changes. Read only from a section that names Razor files. Defaults to `false`
url: https://docs-v3-preview.elastic.dev/reference/razor/code-blocks/curb_razor_format_markup
---

# curb_razor_format_markup
Experimental. With curb_razor_format_code_blocks, also re-indent markup by its nesting, as Microsoft's Razor formatter does. Only indentation changes. Read only from a section that names Razor files.

## Values


| Value   | Notes |
|---------|-------|
| `true`  |       |
| `false` |       |

**Default:** `false`
Experimental, and only on top of `curb_razor_format_code_blocks`, from a section whose glob names Razor files:
```ini
[*.{razor,cshtml}]
curb_razor_format_code_blocks = true
curb_razor_format_markup = true
```

Each markup line goes one indent in per element and code block it sits in, as Microsoft's Razor formatter puts it. Only a line's leading whitespace changes; the content of `<script>`, `<style>`, `<pre>` and `<textarea>`, comments and continued attribute lines stay as written, and a file whose tags do not balance is left alone. See [Razor](https://docs-v3-preview.elastic.dev/workflow/razor).

### `curb_razor_format_markup = true`

```ini
curb_razor_format_markup = true
```

<tab-set>
  <tab-item title="Before">
    ```html
    <div class="card">
    <h3>@Title</h3>
    @if (Items.Count > 0)
    {
    <ul>
    @foreach (var item in Items)
    {
    <li>@item</li>
    }
    </ul>
    }
    </div>
    ```
  </tab-item>

  <tab-item title="After">
    ```html
    <div class="card">
      <h3>@Title</h3>
      @if (Items.Count > 0)
      {
        <ul>
          @foreach (var item in Items)
          {
            <li>@item</li>
          }
        </ul>
      }
    </div>
    ```
  </tab-item>
</tab-set>


### `curb_razor_format_markup = false`

```ini
curb_razor_format_markup = false
```

<tab-set>
  <tab-item title="Before">
    ```html
    <div class="card">
    <h3>@Title</h3>
    @if (Items.Count > 0)
    {
    <ul>
    @foreach (var item in Items)
    {
    <li>@item</li>
    }
    </ul>
    }
    </div>
    ```
  </tab-item>

  <tab-item title="After">
    ```html
    <div class="card">
    <h3>@Title</h3>
    @if (Items.Count > 0)
    {
    <ul>
    @foreach (var item in Items)
    {
    <li>@item</li>
    }
    </ul>
    }
    </div>
    ```
  </tab-item>
</tab-set>