Skip to content

Conversation

@Keylan
Copy link

@Keylan Keylan commented Jan 20, 2026

Summary

Fixes #595

Treats standalone \r (carriage return) as a line break per the YAML 1.2 specification, which defines line breaks as \n, \r\n, or \r.

Changes

  • Lexer: Added findLineBreak() method and updated parsing functions to handle \r as a line break
  • CST: Added \r case to tokenType()
  • Block scalar resolution: Updated splitLines() regex to split on \r
  • Flow scalar resolution: Updated foldLines() and foldNewline() to handle \r

Notes

This PR was developed with LLM assistance.

@eemeli
Copy link
Owner

eemeli commented Jan 21, 2026

Before considering this, my question from #595 (comment) remains relevant:

While recognising that this is a divergence from the spec, does it affect any real-world use for you? As in, do you have some content that is actually using a lone \r as a line break?

If there's no actual content using \r as a line break, there's no reason to make it possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Single carriage return (\r) not treated as line break

2 participants