☁️ 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 when encountered in content parser configurations.

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
    └── params
        └── *
            └── Content Parser Configuration
                └── options
                    └── forbidden_tokens
Type:
Array<forbidden_tokens[*]>
Items:
[*]string#

This key represents an individual forbidden token string in the params.*(content-parser-config).options.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
          forbidden_tokens:
            - <
{
  "_snippets": {
    "highlight": {
      "snippet": "<<highlight>> [[content]] <</highlight>>",
      "params": {
        "content": {
          "parser": "content",
          "options": {
            "editor_key": "highlighted_text",
            "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
          forbidden_tokens:
            - <
{
  "_snippets": {
    "highlight": {
      "snippet": "<<highlight>> [[content]] <</highlight>>",
      "params": {
        "content": {
          "parser": "content",
          "options": {
            "editor_key": "highlighted_text",
            "forbidden_tokens": [
              "<"
            ]
          }
        }
      }
    }
  }
}
Open in a new tab