☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

block

Table of contents

Description:

This key defines block-level formatting options for snippet output.

The value is an object that can contain leading, trailing, and indent properties. These options control whitespace and indentation for multi-line snippet content.

Appears in:
└── Snippet Style
    └── block
Type:
Object
Properties:
indentstring#

This key defines the indentation string used for block-level snippet content.

The value is a string that specifies the indentation tokens (typically spaces or tabs) applied to each line of block-level snippet content.

Show examplesHide examples

In this example, we have configured block indentation to use two spaces.

Copied to clipboard
_snippets:
  highlight:
    snippet: <<highlight>> [[content]] <</highlight>>
    params:
      content:
        parser: content
        options:
          style:
            block:
              indent: '  '
{
  "_snippets": {
    "highlight": {
      "snippet": "<<highlight>> [[content]] <</highlight>>",
      "params": {
        "content": {
          "parser": "content",
          "options": {
            "style": {
              "block": {
                "indent": "  "
              }
            }
          }
        }
      }
    }
  }
}
leadingstring#

This key defines the leading whitespace string for block-level snippet content.

The value is a string that specifies whitespace tokens (typically newlines) inserted before block-level snippet content.

Show examplesHide examples

In this example, we have configured block leading whitespace to use a newline.

Copied to clipboard
_snippets:
  highlight:
    snippet: <<highlight>> [[content]] <</highlight>>
    params:
      content:
        parser: content
        options:
          style:
            block:
              leading: \n
{
  "_snippets": {
    "highlight": {
      "snippet": "<<highlight>> [[content]] <</highlight>>",
      "params": {
        "content": {
          "parser": "content",
          "options": {
            "style": {
              "block": {
                "leading": "\\n"
              }
            }
          }
        }
      }
    }
  }
}
trailingstring#

This key defines the trailing whitespace string for block-level snippet content.

The value is a string that specifies whitespace tokens (typically newlines) inserted after block-level snippet content.

Show examplesHide examples

In this example, we have configured block trailing whitespace to use a newline.

Copied to clipboard
_snippets:
  highlight:
    snippet: <<highlight>> [[content]] <</highlight>>
    params:
      content:
        parser: content
        options:
          style:
            block:
              trailing: \n
{
  "_snippets": {
    "highlight": {
      "snippet": "<<highlight>> [[content]] <</highlight>>",
      "params": {
        "content": {
          "parser": "content",
          "options": {
            "style": {
              "block": {
                "trailing": "\\n"
              }
            }
          }
        }
      }
    }
  }
}
Examples:

In this example, we have configured block formatting with leading, trailing, and indent options.

Copied to clipboard
_snippets:
  highlight:
    snippet: <<highlight>> [[content]] <</highlight>>
    params:
      content:
        parser: content
        options:
          style:
            block:
              leading: \n
              trailing: \n
              indent: '  '
{
  "_snippets": {
    "highlight": {
      "snippet": "<<highlight>> [[content]] <</highlight>>",
      "params": {
        "content": {
          "parser": "content",
          "options": {
            "style": {
              "block": {
                "leading": "\\n",
                "trailing": "\\n",
                "indent": "  "
              }
            }
          }
        }
      }
    }
  }
}
Open in a new tab