YamlDotNet icon indicating copy to clipboard operation
YamlDotNet copied to clipboard

Expose the indent for block scalar

Open 928PJY opened this issue 10 months ago • 1 comments
trafficstars

Is your feature request related to a problem? Please describe. We are leveraging this library to parse the YAML content written by our end-users. We need accurate location information of the source content. However, for the block scalar type, the node start and end information currently refer to the range of the entire property value, including the | or >, but not the value (indentation and block syntax are removed). This prevents us from obtaining accurate location information. For example:

property: |
  value

When we use the parser.Consume<NodeEvent>() to get the node after key, we get a Literal scalar type with the following property:

  • Start.Line: 1
  • Start.Column: 11
  • End.Line: 3
  • End Column: 1
  • Value: value\n

Describe the solution you'd like We expected the removed indent to be visible on the scalar node as well so we can accurately report the location information if we need to address an issue with the value, such as:

  • Indent: 2

928PJY avatar Dec 25 '24 07:12 928PJY

Just to clarify that you’re thinking the values should represent the location of the letter v instead of the |

EdwardCooke avatar Jan 18 '25 01:01 EdwardCooke