yq/pkg/yqlib/doc/usage
copilot-swe-agent[bot] b99f4174ec
Fix TOML encoder to prefer readable table sections over inline tables
When converting from YAML/JSON to TOML, the encoder now always uses
readable TOML table section syntax ([section]) instead of compact inline
hash table syntax (key = { ... }), which better matches TOML's goal as
a human-focused configuration format.

Changes:
- decoder_toml.go: Mark inline TOML tables with FlowStyle so round-trips
  can be distinguished from YAML flow mappings
- encoder_toml.go:
  - encodeTopLevelEntry: use FlowStyle check instead of EncodeSeparate to
    decide inline vs table section (all block mappings now become tables)
  - encodeSeparateMapping: count FlowStyle children as attributes; use
    recursive encodeSeparateMapping for nested non-flow mappings
  - encodeMappingBodyWithPath: emit non-flow child mappings as sub-table
    sections instead of inline tables
- toml_test.go: add encode (YAML→TOML) test scenarios, update roundtrip
  expectations for inline tables (now expanded to table sections)

Agent-Logs-Url: https://github.com/mikefarah/yq/sessions/4824a219-6d5e-42e7-bca1-a8a277bf8c6a

Co-authored-by: mikefarah <1151925+mikefarah@users.noreply.github.com>
2026-04-06 09:59:10 +00:00
..
headers feat: K8S KYAML output format support (#2560) 2026-01-01 15:14:53 +11:00
base64.md Strip whitespace when decoding base64 #2507 2025-11-15 14:11:55 +11:00
convert.md Refactoring Yaml encoder prefs 2024-02-24 15:36:16 +11:00
csv-tsv.md Added new CSV option to turn off auto-parsing #1947 2024-02-15 13:11:53 +11:00
formatting-expressions.md Adding shebang documentation 2024-02-16 11:03:35 +11:00
hcl.md spelling 2025-12-20 09:55:29 +11:00
kyaml.md feat: K8S KYAML output format support (#2560) 2026-01-01 15:14:53 +11:00
lua.md Lua output fixes (#1811) 2023-10-12 11:25:26 +11:00
properties.md Update docs and tests for --properties-separator flag 2025-01-22 09:53:51 +11:00
recipes.md Added prune recipe 2024-02-21 14:50:55 +11:00
shellvariables.md Add --shell-key-separator flag for customizable shell output format 2025-11-07 20:02:58 +11:00
toml.md Fix TOML encoder to prefer readable table sections over inline tables 2026-04-06 09:59:10 +00:00
xml.md Fixed comment parsing, added generated docs 2025-12-08 20:30:47 +11:00