Skip to content

fix: string values starting with \n exported as invalid YAML literal block#128

Merged
xiwenc merged 1 commit intomxlint:mainfrom
KaracaerFurkan:bugfix/yaml-trim-leading-newlines
Apr 29, 2026
Merged

fix: string values starting with \n exported as invalid YAML literal block#128
xiwenc merged 1 commit intomxlint:mainfrom
KaracaerFurkan:bugfix/yaml-trim-leading-newlines

Conversation

@KaracaerFurkan
Copy link
Copy Markdown

String fields whose value starts with a newline (e.g. expression values) were exported with a |4 literal block indicator, producing invalid YAML that caused the linter to crash with Error parsing YAML file.

Root cause: after indent-stripping, the leading \n was still present, triggering the multiline code path even when the actual content is a single line. The fix trims leading newlines before the multiline check so these values are exported as plain scalars.

@xiwenc
Copy link
Copy Markdown
Member

xiwenc commented Apr 29, 2026

thanks Furkan!

This does indeed solve your specific case. Will accept it for now. Will look into this in more detail to have a more structural solution that works in "all" cases.

@xiwenc xiwenc merged commit c58ce31 into mxlint:main Apr 29, 2026
6 of 7 checks passed
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.

2 participants