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

forbidden_tokens

Table of contents

Description:

This key defines tokens that stop parsing content as soon as they are encountered when parsing snippet parameters.

The value is an array of strings, where each string specifies a forbidden token. This is useful when the content parser is being greedy and consuming more input than intended.

Appears in:
└── Snippet Format
    └── forbidden_tokens
Type:
Array<forbidden_tokens[*]>
Items:
[*]string#

This key represents an individual forbidden token string in the forbidden_tokens array.

The value is a string that specifies a token that will stop parsing content when encountered. This is useful when the content parser is being greedy and consuming more input than intended.

Show examplesHide examples

In this example, we have configured a forbidden token to stop parsing when encountering a less-than sign.

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

In this example, we have configured forbidden tokens to stop parsing when encountering a less-than sign.

Copied to clipboard
_snippets:
  highlight:
    snippet: <<highlight>> [[content]] <</highlight>>
    params:
      content:
        parser: content
        options:
          editor_key: highlighted_text
          format:
            forbidden_tokens:
              - <
{
  "_snippets": {
    "highlight": {
      "snippet": "<<highlight>> [[content]] <</highlight>>",
      "params": {
        "content": {
          "parser": "content",
          "options": {
            "editor_key": "highlighted_text",
            "format": {
              "forbidden_tokens": [
                "<"
              ]
            }
          }
        }
      }
    }
  }
}
Open in a new tab