Skip to content

Default scalar style never chooses literal and folded styles #341

@Herringway

Description

@Herringway

For long strings, especially those with newlines, these styles are the best for readability. Currently, dyaml chooses quoted styles, resulting in output littered with \<actual newline> AND \n, which are annoying to read.
An example submitted to me:

%YAML 1.1
---
name: tar
doc: "libtar - small library for manipulating TAR files.\n\nAuthor:\n\nMark D. Roth,\
  \ roth@uiuc.edu\n  Campus Information Technologies and Educational Services\n  University\
  \ of Illinois at Urbana-Champaign\n\n\nadded by my app!\n    yeeey!\n"
types: null
objects: null
functions: null
ignored-functions: null

A much more readable default for the doc value would be literal style, resulting in:

%YAML 1.1
---
name: tar
doc: |
  libtar - small library for manipulating TAR files.
  
  Author:
  
  Mark D. Roth, roth@uiuc.edu
    Campus Information Technologies and Educational Services
    University of Illinois at Urbana-Champaign
  
  
  added by my app!
      yeeey!
types: null
objects: null
functions: null
ignored-functions: null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions