Skip to content

feat: add newline option for output line endings - #728

Closed
mir-ashiq wants to merge 1 commit into
eemeli:mainfrom
mir-ashiq:add-newline-option
Closed

mir-ashiq wants to merge 1 commit into
eemeli:mainfrom
mir-ashiq:add-newline-option

Conversation

@mir-ashiq

@mir-ashiq mir-ashiq commented Sep 25, 2026 •

Copy link
Copy Markdown

Adds a newline option to ToStringOptions, allowing stringify() and
Document#toString() to emit \r\n line endings, as discussed in #706.

Following the approach suggested there, the substitution is applied as a
final .replace(/\r?\n/g, '\r\n') over the completed document, which is
safe since line breaks in scalars are normalized to \n when parsing.

  • src/options.ts — declare the newline option
  • src/stringify/stringify.ts — default value ('\n')
  • src/stringify/stringifyDocument.ts — apply the replacement at the final join
  • tests/doc/stringify.ts — 5 tests: default output, whole-document
    conversion, Document#toString, directives, and toStringDefaults
  • docs/03_options.md — document the new option

Closes #706


LLM Use

Adding this disclosure after the fact: the code, tests and the original description of this PR were prepared with AI assistance (Claude), and the comment on #706 was AI-drafted as well. The contributing guide's LLM section asks for this to be declared and pre-approved in an issue first; that step was missed here because I looked for CONTRIBUTING at the repo root instead of docs/. Sorry for that.

How to proceed is entirely up to you: if you'd rather not take an assisted PR that skipped the approval step, close it and that's completely fair. If it can continue as declared LLM-assisted work, I can explain every part of the implementation and will keep further issue/PR comments in my own words.

@mir-ashiq
mir-ashiq marked this pull request as ready for review September 25, 2026 16:16
Copilot AI lite review requested due to automatic review settings September 25, 2026 16:16

This comment was marked as spam.

@eemeli

eemeli commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Closing due to ignoring PR template and unapproved LLM use.

@eemeli eemeli closed this Sep 27, 2026
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.

Add setting to configure line ending sequence.

3 participants