root_value_boundary_optional

On this page

Description:

This key defines which value types do not require root value boundaries when parsing snippet parameters.

The value is an object where each property key is a value type name and each property value is a boolean. When set to true, that value type does not require root value boundaries. For example, MDX specifies { string: true }, which allows strings to exist as <Component arg="true" /> rather than <Component arg={"true"} />.

Appears in:
└── Snippet Format
    └── root_value_boundary_optional
Type:
Object<root_value_boundary_optional.*>
Values:
*boolean#

This key represents an individual optional root value boundary configuration in the root_value_boundary_optional object.

The value is a boolean that determines whether the root value boundary is optional for a specific parameter name. When set to true, the boundary tokens are optional for that parameter.

Appears in: Snippet Format root_value_boundary_optional.

Show examplesHide examples

In this example, we have configured root value boundaries to be optional for the title parameter.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[param]]>>
    params:
      param:
        parser: argument
        options:
          format:
            root_value_boundary_optional:
              title: true
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[param]]>>",
      "params": {
        "param": {
          "parser": "argument",
          "options": {
            "format": {
              "root_value_boundary_optional": {
                "title": true
              }
            }
          }
        }
      }
    }
  }
}
Examples:

In this example, we have configured root value boundaries to be optional for strings.

Copied to clipboard
_snippets:
  example:
    snippet: <<example [[param]]>>
    params:
      param:
        parser: argument
        options:
          format:
            root_value_boundary_optional:
              string: true
{
  "_snippets": {
    "example": {
      "snippet": "<<example [[param]]>>",
      "params": {
        "param": {
          "parser": "argument",
          "options": {
            "format": {
              "root_value_boundary_optional": {
                "string": true
              }
            }
          }
        }
      }
    }
  }
}
Open in a new tab