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

Content Parser Configuration

Table of contents

Description:

This key defines a parser configuration that parses rich multiline content, such as the content between paired tags. Can be configured to parse nested snippets within.

Appears in:
└── Snippet
    └── params
        └── *
            └── Content Parser Configuration
Type:
Object
Properties:
optionsObject Required#

This key defines configuration options for content parser configurations.

The value is an object that can contain editor_key, indented_by, default, trim_text, allow_nested, raw, forbidden_tokens, optional, allow_leading, escape_indented_blocks, parse_newline_character, ignore_unpaired_backticks, escape_fenced_blocks, and style properties. These options control how content between snippet boundaries is parsed.

Show examplesHide examples

In this example, we have configured content parser options with an editor key and forbidden tokens.

Copied to clipboard
_snippets:
  highlight:
    snippet: <<highlight>> [[content]] <</highlight>>
    params:
      content:
        parser: content
        options:
          editor_key: highlighted_text
          forbidden_tokens:
            - <
{
  "_snippets": {
    "highlight": {
      "snippet": "<<highlight>> [[content]] <</highlight>>",
      "params": {
        "content": {
          "parser": "content",
          "options": {
            "editor_key": "highlighted_text",
            "forbidden_tokens": [
              "<"
            ]
          }
        }
      }
    }
  }
}
parser"content" Required#

This key defines the parser type for content parser configurations.

The value must be content. This specifies that the parameter uses the content parser, which parses content between snippet boundaries.

Show examplesHide examples

In this example, we have configured a content parser for a snippet parameter.

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

In this example, we have configured a content parser to parse rich multiline content between paired tags.

Liquid
Copied to clipboard
{% highlight "js" %} let a = b; {% endhighlight %}
                    └──────────┘
Open in a new tab