Recent searches

in

options

On this page

This key defines configuration options for key-value list parser configurations.

The value is an object that can contain models, format, and style properties. These options control how multiple key-value pairs are parsed and validated.

Appears in

└── Snippet
    └── params
        └── *
            └── Key Value List Parser Configuration
                └── options

Type

Object

Properties

modelsArray<Snippet Model> Required#

This key defines the models for each key in key-value list parser configurations.

The value is an object where each property key is a key name and each property value is a model configuration object. These models define how each key-value pair is parsed and validated.

Appears in: Key Value List Parser Configuration options.

Show examplesHide examples

In this example, we have configured models for key-value pairs in a key-value list parser.

Copied to clipboard
_snippets:
  example:
    snippet: <<example key1=value1 key2=value2>>
    params:
      params:
        parser: key_values
        options:
          models:
            key1:
              editor_key: value1_input
            key2:
              editor_key: value2_input
{
  "_snippets": {
    "example": {
      "snippet": "<<example key1=value1 key2=value2>>",
      "params": {
        "params": {
          "parser": "key_values",
          "options": {
            "models": {
              "key1": {
                "editor_key": "value1_input"
              },
              "key2": {
                "editor_key": "value2_input"
              }
            }
          }
        }
      }
    }
  }
}
styleObject#

This key defines styling options for snippet output formatting.

The value is an object that can contain output, inline, and block properties. These options control how snippet content is parsed and formatted to produce cleaner source code.

Appears in: Content Parser Configuration options, Key Value List Parser Configuration options, Repeating Parser Configuration options, Wrapper Parser Configuration options.

Show examplesHide examples

In this example, we have configured snippet style with inline and block formatting options.

Copied to clipboard
_snippets:
  highlight:
    snippet: <<highlight>> [[content]] <</highlight>>
    params:
      content:
        parser: content
        options:
          style:
            inline:
              leading: ' '
              trailing: ' '
            block:
              leading: \n
              trailing: \n
              indent: '  '
{
  "_snippets": {
    "highlight": {
      "snippet": "<<highlight>> [[content]] <</highlight>>",
      "params": {
        "content": {
          "parser": "content",
          "options": {
            "style": {
              "inline": {
                "leading": " ",
                "trailing": " "
              },
              "block": {
                "leading": "\\n",
                "trailing": "\\n",
                "indent": "  "
              }
            }
          }
        }
      }
    }
  }
}

Examples

In this example, we have configured key-value list parser options with models.

Copied to clipboard
_snippets:
  example:
    snippet: <<example key1=value1 key2=value2>>
    params:
      params:
        parser: key_values
        options:
          models:
            key1:
              editor_key: value1_input
            key2:
              editor_key: value2_input
{
  "_snippets": {
    "example": {
      "snippet": "<<example key1=value1 key2=value2>>",
      "params": {
        "params": {
          "parser": "key_values",
          "options": {
            "models": {
              "key1": {
                "editor_key": "value1_input"
              },
              "key2": {
                "editor_key": "value2_input"
              }
            }
          }
        }
      }
    }
  }
}
Open in a new tab