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

options

Table of contents

Description:

This key defines configuration options for wrapper parser configurations.

The value is an object that can contain snippet and remove_empty properties. These options control which snippet configuration is wrapped and whether empty values are removed.

Appears in:
└── Snippet
    └── params
        └── *
            └── Wrapper Parser Configuration
                └── options
Type:
Object Required
Properties:

This key toggles whether CloudCannon will remove empty values from wrapper parser configurations.

Setting this key to true will remove empty values from the wrapped snippet configuration.

By default, this key is false (i.e., empty values are not removed).

Show examplesHide examples

In this example, we have configured wrapper parser to remove empty values.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[wrapped_content]]>>
    params:
      wrapped_content:
        parser: wrapper
        options:
          snippet: content
          remove_empty: true
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[wrapped_content]]>>",
      "params": {
        "wrapped_content": {
          "parser": "wrapper",
          "options": {
            "snippet": "content",
            "remove_empty": true
          }
        }
      }
    }
  }
}
snippetstring Required#

This key defines the snippet configuration to wrap for wrapper parser configurations.

The value is a string that specifies the key name of another snippet configuration defined in _snippets. This snippet configuration will be wrapped by the wrapper parser.

Show examplesHide examples

In this example, we have configured a snippet reference for wrapper parser.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[wrapped_content]]>>
    params:
      wrapped_content:
        parser: wrapper
        options:
          snippet: content
  content:
    snippet: <<content [[text]]>>
    params:
      text:
        parser: content
        options:
          editor_key: content_text
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[wrapped_content]]>>",
      "params": {
        "wrapped_content": {
          "parser": "wrapper",
          "options": {
            "snippet": "content"
          }
        }
      }
    },
    "content": {
      "snippet": "<<content [[text]]>>",
      "params": {
        "text": {
          "parser": "content",
          "options": {
            "editor_key": "content_text"
          }
        }
      }
    }
  }
}
styleObject#

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.

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

In this example, we have configured wrapper parser options with a snippet reference.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[wrapped_content]]>>
    params:
      wrapped_content:
        parser: wrapper
        options:
          snippet: content
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[wrapped_content]]>>",
      "params": {
        "wrapped_content": {
          "parser": "wrapper",
          "options": {
            "snippet": "content"
          }
        }
      }
    }
  }
}
Open in a new tab