Skip to content

Sorting messes up some strings #227

@Skeeve

Description

@Skeeve

In my real world example I had a File which just looked similar to YAML in that it had a comment at the top.

So in order to make it a proper YAML, I made the comment a multiline string.

Unfortunately sorting messed the string and the file up.

Here is a working example.

Original YAML:

'!': |
    #####################################
    ##
    ## Zeta:
    ##     - C
    ##     - A
    ##     - B
    ## Beta:
    ##     - B
    ##     - C
    ##     - A
    ## Alpha:
    ##     - A
    ##     - B
    ##     - C
    ##
    #####################################

Zeta:
    - C
    - A
    - B
Beta:
    - B
    - C
    - A
Alpha:
    - A
    - B
    - C

After Sorting

---
'!': |
    #####################################
    ##
Alpha:
  - A
  - B
  - C
Beta:
  - B
  - C
  - A
Zeta:
  - C
  - A
  - B    ##
    ##     - A
    ## Alpha:
    ##     - C
    ##     - A
    ##     - B
    ## Beta:
    ##     - C
    ##     - A
    ##     - B
    ## Zeta:
    ##     - C
    #####################################

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions