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

format

Table of contents

Description:

This key defines formatting options for literal parser configurations.

The value is an object that can contain string_boundary properties. These options control how the literal value is parsed and matched.

Appears in:
└── Snippet
    └── params
        └── *
            └── Literal Parser Configuration
                └── options
                    └── format
Type:
Object
Properties:

This key defines the valid tokens that can bound a string when parsing literal values.

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 ["'", "\""].

Show examplesHide examples

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

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

In this example, we have configured literal parser format options with string boundaries.

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