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

Snippet Style

On this page

Description:

This key defines styling options for snippet output formatting.

The value is an object that can contain output, inline, and block properties. These options control how snippet content is parsed and formatted to produce cleaner source code.

Appears in:
└── Snippet
    └── params
        └── *
            ├── Content Parser Configuration
            │   └── options
            │       └── Snippet Style
            ├── Key Value List Parser Configuration
            │   └── options
            │       └── Snippet Style
            ├── Repeating Parser Configuration
            │   └── options
            │       └── Snippet Style
            └── Wrapper Parser Configuration
                └── options
                    └── Snippet Style
Type:
Object
Properties:
blockObject#

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.

Show examplesHide 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": "  "
              }
            }
          }
        }
      }
    }
  }
}
inlineObject#

This key defines inline formatting options for snippet output.

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

Show examplesHide examples

In this example, we have configured inline formatting with leading and trailing spaces.

Copied to clipboard
_snippets:
  highlight:
    snippet: <<highlight>> [[content]] <</highlight>>
    params:
      content:
        parser: content
        options:
          style:
            inline:
              leading: ' '
              trailing: ' '
{
  "_snippets": {
    "highlight": {
      "snippet": "<<highlight>> [[content]] <</highlight>>",
      "params": {
        "content": {
          "parser": "content",
          "options": {
            "style": {
              "inline": {
                "leading": " ",
                "trailing": " "
              }
            }
          }
        }
      }
    }
  }
}
outputstring Required#

This key defines the output format style for snippet content.

The value can be legacy, inline, or block. This controls how snippet content is formatted when output to source code.

Allowed values: legacy inline block

Show examplesHide examples

In this example, we have configured snippet output style to use block formatting.

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

In this example, we have configured snippet style with inline and block formatting options.

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