Description
Parse a restricted YAML block-scalar style/indent/chomping indicator token in either allowed modifier order; does not parse indentation, content or a YAML document.
YAML uses context-sensitive indicators for scalar styles, indentation, tags, anchors, and document boundaries. A token may be meaningful only within the surrounding stream and indentation structure. Recognizing one header or marker is distinct from parsing a document or resolving its values.
Parse a restricted YAML block-scalar style/indent/chomping indicator token in either allowed modifier order; does not parse indentation, content or a YAML document.
When to use this tool
Use Parsing: Yaml Block Chomp Indicator when you need to recognize the supported YAML marker or header token before a broader parsing step.
How to use the tool and how it works
- Enter indicator. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Accept | or > followed by an optional indentation digit 1-9 and optional chomping sign, in either permitted order. Return style, chomping, and explicitIndent as the digit or zero when absent inside result.1
A YAML block-scalar header distinguishes style, indentation, and chomping. Chomping governs final line breaks and trailing empty lines, while this tool only returns the indicator labels.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| indicator | Indicator | Required. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Object containing the calculated result members described below. | Required. Object. |
| result.style | Style | Calculated result member: string. |
| result.chomping | Chomping | Calculated result member: string. |
| result.explicitIndent | Digit 1-9, or zero meaning no explicit indentation indicator. | Calculated result member: number. |
{
"input": {
"indicator": "|2-"
},
"output": {
"result": {
"style": "literal",
"chomping": "strip",
"explicitIndent": 2
}
}
} Limitations and assumptions
- ExplicitIndent=0 means unspecified rather than a zero-space indentation rule. Only the indicator token is parsed; scalar content, parent indentation, trailing comments, and complete YAML validity are separate.
- Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
Alternative or Complementary methods
Use a full YAML parser for stream context, indentation, aliases, tags, scalar content, and document validity. Treat the output as the stated local recognition result.
References
-
Calculation and input contract: parse/yaml-block-chomp-indicator — tool.io
-
YAML 1.2.2: Block Scalar Headers — YAML Language Development Team
Similar or alternative tools
- Yaml Block Scalar Chomping Token
Return style=literal or folded and chomping=keep for +, strip for -, or clip when absent.
- Yaml Explicit Document End Marker
Return endMarker and the text after # without trimming, or an empty comment when absent or unmatched.