options

On this page

Description:

This key defines configuration options for repeating literal parser configurations.

The value is an object that can contain literal, default, minimum, and editor_key properties. These options control what literal string is matched and how many times it can appear.

Appears in:
└── Snippet
    └── params
        └── *
            └── Repeating Literal Parser Config
                └── options
Type:
Object Required
Properties:
defaultnumber#

This key defines the default count for repeating literal parser configurations.

The value is a number that specifies how many times the literal should appear by default.

Appears in: Repeating Literal Parser Config options.

Show examplesHide examples

In this example, we have configured a default count for repeating literal parser.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[literal_param]]>>
    params:
      literal_param:
        parser: repeating_literal
        options:
          literal: separator
          default: 1
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[literal_param]]>>",
      "params": {
        "literal_param": {
          "parser": "repeating_literal",
          "options": {
            "literal": "separator",
            "default": 1
          }
        }
      }
    }
  }
}

This key defines the editor key for repeating literal parser configurations.

The value is a string that specifies the key name of an input to use for editing the repeating literal value.

Appears in: Repeating Literal Parser Config options.

Show examplesHide examples

In this example, we have configured an editor key for repeating literal parser.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[literal_param]]>>
    params:
      literal_param:
        parser: repeating_literal
        options:
          literal: separator
          default: 1
          editor_key: separator_count
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[literal_param]]>>",
      "params": {
        "literal_param": {
          "parser": "repeating_literal",
          "options": {
            "literal": "separator",
            "default": 1,
            "editor_key": "separator_count"
          }
        }
      }
    }
  }
}
literalstring Required#

This key defines the literal string value that can be repeated for repeating literal parser configurations.

The value is a string that specifies the exact text that can appear multiple times in the snippet.

Appears in: Repeating Literal Parser Config options.

Show examplesHide examples

In this example, we have configured a literal value for repeating literal parser.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[literal_param]]>>
    params:
      literal_param:
        parser: repeating_literal
        options:
          literal: separator
          default: 1
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[literal_param]]>>",
      "params": {
        "literal_param": {
          "parser": "repeating_literal",
          "options": {
            "literal": "separator",
            "default": 1
          }
        }
      }
    }
  }
}
minimumnumber#

This key defines the minimum number of times that the literal string must occur to match this parser.

A good example is a markdown code block, which can open with any number of backticks greater than or equal to three.

Appears in: Repeating Literal Parser Config options.

Examples:

In this example, we have configured repeating literal parser options with a literal value and default count.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[literal_param]]>>
    params:
      literal_param:
        parser: repeating_literal
        options:
          literal: separator
          default: 1
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[literal_param]]>>",
      "params": {
        "literal_param": {
          "parser": "repeating_literal",
          "options": {
            "literal": "separator",
            "default": 1
          }
        }
      }
    }
  }
}
Open in a new tab