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

options

Table of contents

Description:

This key defines configuration options for optional 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
        └── *
            └── Optional Parser Configuration
                └── options
Type:
Object Required
Properties:

This key toggles whether to output an empty string, or no value at all.

Setting this key to true will output no value at all instead of an empty string. This will bubble up to any outer parsers, so may control whether they return output.

By default, this key is false (i.e., an empty string is output).

snippetstring Required#

This key defines a snippet string to wrap and make repeatable.

This shares the same params as the outermost snippet, so may reference itself or other params.

Examples:

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

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