- Description:
This key defines configuration options for repeating parser configurations.
The value is an object that can contain
snippet,editor_key,output_delimiter,default_length,style, andoptionalproperties. These options control which snippet configuration is repeated and how repetitions are handled.- Appears in:
└── Snippet └── params └── * └── Repeating Parser Configuration └── options- Type:
ObjectRequired- Properties:
This key defines how many repetitions should be created in the initial data when initializing a new Snippet.
This key defines the editor key for repeating parser configurations.
The value is a string that specifies the key name of an input to use for editing repeating snippet instances.
Show examplesHide examples
In this example, we have configured an editor key for repeating parser.
Copied to clipboard_snippets: example: snippet: <<example [[repeating_content]]>> params: repeating_content: parser: repeating options: snippet: content editor_key: content_items{ "_snippets": { "example": { "snippet": "<<example [[repeating_content]]>>", "params": { "repeating_content": { "parser": "repeating", "options": { "snippet": "content", "editor_key": "content_items" } } } } } }This key toggles whether CloudCannon will treat repeating snippets as optional when parsing snippet parameters.
Setting this key to
truewill make the repeating snippet instances optional, allowing snippets to match even when no instances are present.By default, this key is
false(i.e., at least one instance is required).Show examplesHide examples
In this example, we have configured repeating parser to treat instances as optional.
Copied to clipboard_snippets: example: snippet: <<example [[repeating_content]]>> params: repeating_content: parser: repeating options: snippet: content optional: true{ "_snippets": { "example": { "snippet": "<<example [[repeating_content]]>>", "params": { "repeating_content": { "parser": "repeating", "options": { "snippet": "content", "optional": true } } } } } }This key defines how to format the output for parsers such as the content and repeating parsers.
Valid values are either
inlineorblock.When set to
block, values will always be output with leading and trailing newlines.When set to
inline, values will always be output on a single line, with newlines inserted as\n.If unspecified,
inlinewill be chosen when the value is a single line, otherwiseblockformatting will be used.This key defines the snippet configuration to repeat for repeating parser configurations.
The value is a string that specifies the key name of another snippet configuration defined in
_snippets. This snippet configuration will be repeated multiple times.Show examplesHide examples
In this example, we have configured a snippet reference for repeating parser.
Copied to clipboard_snippets: example: snippet: <<example [[repeating_content]]>> params: repeating_content: parser: repeating options: snippet: content content: snippet: <<content [[text]]>> params: text: parser: content options: editor_key: content_text{ "_snippets": { "example": { "snippet": "<<example [[repeating_content]]>>", "params": { "repeating_content": { "parser": "repeating", "options": { "snippet": "content" } } } }, "content": { "snippet": "<<content [[text]]>>", "params": { "text": { "parser": "content", "options": { "editor_key": "content_text" } } } } } }This key defines styling options for snippet output formatting.
The value is an object that can contain
output,inline, andblockproperties. These options control how snippet content is parsed and formatted to produce cleaner source code.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 repeating parser options with a snippet reference.
Copied to clipboard_snippets: example: snippet: <<example [[repeating_content]]>> params: repeating_content: parser: repeating options: snippet: content{ "_snippets": { "example": { "snippet": "<<example [[repeating_content]]>>", "params": { "repeating_content": { "parser": "repeating", "options": { "snippet": "content" } } } } } }