Skip to content

feat: support for multiline values [issue #33] - #295

Open
pgalbraith wants to merge 4 commits into
npm:mainfrom
pgalbraith:feature/multiline
Open

pgalbraith wants to merge 4 commits into
npm:mainfrom
pgalbraith:feature/multiline

Conversation

@pgalbraith

@pgalbraith pgalbraith commented Nov 14, 2025 •

Copy link
Copy Markdown

Issue #33 was closed as completed, but I think it was really rejected with a "submit a PR if you really need it" suggestion.

This adds support for multine entries as requested in the issue, similar to the way Python configparser handles ini files.

Multiline values are a convenience when you have a large value (e.g. a comma separated list) assigned to a single key. Breaking the value across several lines makes for much easier reading and maintenance.

Issue npm#33 was closed as completed, but I think it was really rejected.
This adds support for multine entries as requested in the issue, similar
to the way Python configparser handles ini files.

Multiline values are a convenience when you have a large value (e.g. a
comma separated list) assigned to a single key.  Breaking the value
across several lines makes for much easier reading and maintenance.
@pgalbraith
pgalbraith requested a review from a team as a code owner November 14, 2025 03:44
- treat a value containing \r as ineligible for verbatim continuation
  lines, since the decoder drops a CR before LF and the win32 eol adds
  another, which made the encode snapshots platform-dependent
- drop the \r from the modified foo.ini fixture value
- add tests for the array-entry strict and legacy paths and for
  carriage returns, restoring 100% coverage
- document the carriage-return rule for strictMultiline in the README
- write a value as indented continuation lines only when every line
  after the first is indented, non-blank, free of "=", not a comment,
  and the value has no carriage return; otherwise JSON-quote it
- escape the first line with safe() like any other value
- continue array entries in the decoder, matching what the encoder emits
- clear the continuation state on any line that is not a comment or a
  continuation, including unparseable lines
- default strictMultiline to false so stringify never throws where 7.0.0
  did not; true still rejects values that cannot be written verbatim
- restore the original foo.ini fixture value and add explicit
  round-trip tests for every case; document the rules in the README
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.

1 participant