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

string_boundary

Table of contents

Description:

This key defines the valid tokens that can bound a string when parsing snippet parameters.

The value is an array of strings, where each string specifies a valid boundary token. The parser will ensure the matched end token is the same as the start token. To handle common strings with either single or double quotes, this would usually be ["'", "\""].

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

This key represents an individual string boundary token in the string_boundary array.

The value is a string that specifies a valid boundary token for strings. The parser will ensure the matched end token is the same as the start token.

Show examplesHide examples

In this example, we have configured a string boundary to use double quotes.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[param]]>>
    params:
      param:
        parser: argument
        options:
          format:
            string_boundary:
              - '"'
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[param]]>>",
      "params": {
        "param": {
          "parser": "argument",
          "options": {
            "format": {
              "string_boundary": [
                "\""
              ]
            }
          }
        }
      }
    }
  }
}
Examples:

In this example, we have configured string boundaries to allow single and double quotes.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[param]]>>
    params:
      param:
        parser: argument
        options:
          format:
            string_boundary:
              - '"'
              - ''''
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[param]]>>",
      "params": {
        "param": {
          "parser": "argument",
          "options": {
            "format": {
              "string_boundary": [
                "\"",
                "'"
              ]
            }
          }
        }
      }
    }
  }
}
Open in a new tab