- Description:
This key toggles whether matching zero times is a valid state for this parser.
Setting this key to
truewill allow matching zero times as a valid state. Iffalse, this parser requires at least one matching value. Setting this totrueis preferred to wrapping therepeatingparser inside anoptionalparser.By default, this key is
false(i.e., at least one matching value is required).- Appears in:
└── Snippet └── params └── * └── Optional Parser Configuration- Type:
Object- Properties:
This key defines configuration options for optional parser configurations.
The value is an object that can contain
snippetandremove_emptyproperties. These options control which snippet configuration is wrapped and whether empty values are removed.Show examplesHide examples
In this example, we have configured optional parser options with a snippet reference.
Copied to clipboard_snippets: example: snippet: <<example [[optional_content]]>> params: optional_content: parser: optional options: snippet: content{ "_snippets": { "example": { "snippet": "<<example [[optional_content]]>>", "params": { "optional_content": { "parser": "optional", "options": { "snippet": "content" } } } } } }This key defines the parser type for optional parser configurations.
The value must be
optional. This specifies that the parameter uses the optional parser, which wraps another snippet configuration and makes it optional.Show examplesHide examples
In this example, we have configured an optional parser for a snippet parameter.
Copied to clipboard_snippets: example: snippet: <<example [[optional_content]]>> params: optional_content: parser: optional options: snippet: content{ "_snippets": { "example": { "snippet": "<<example [[optional_content]]>>", "params": { "optional_content": { "parser": "optional", "options": { "snippet": "content" } } } } } }- Examples: