Skip to content

fix: preserve empty section names when encoding - #327

Open
Aschenbath wants to merge 1 commit into
npm:mainfrom
Aschenbath:fix/empty-section-roundtrip-326
Open

Aschenbath wants to merge 1 commit into
npm:mainfrom
Aschenbath:fix/empty-section-roundtrip-326

Conversation

@Aschenbath

Copy link
Copy Markdown

parse('[]\na=1\n') produces an empty-name section, but stringify drops its header and moves its contents to the root on the next parse. Treat an explicitly empty section name as present when emitting headers and composing nested section paths. Fixes #326.

Regression coverage includes root keys alongside [], arrays and nested sections, both section-option forms, and the ordinary no-section default. Five assertions fail before the change; all six test files pass afterward with 100% statement, branch, function and line coverage. ESLint passes on Node 24.22.2 / Windows.

npm test reaches the final template-oss-check, which reports drift in the existing GitHub configuration (missing latest/release/v* branch entries). Those configuration files and package metadata are unchanged.

@Aschenbath
Aschenbath requested a review from a team as a code owner November 20, 2026 09:18
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.

[BUG] Keys under an empty section header [] move to the top level after stringify → parse

1 participant