Skip to content

YAML multi-line strings inconsistencies #475

@ItalyPaleAle

Description

@ItalyPaleAle

In recent updates to Chroma, yaml multi-line strings (starting with |) seem to be rendered inconsistently.

Example:

steps:

  # Sets FOO to be "some value" in the script and the next ones
  - bash: |
      FOO="some value"
      echo "##vso[task.setvariable variable=FOO]$FOO"

  # Using the $() syntax, the value is replaced inside Azure Pipelines before being submitted to the script task
  - bash: |
      echo "$(FOO)"

  # The same variable is also present as environmental variable in scripts; here the variable expansion happens within bash
  - bash: |
      echo "$FOO"

This renders as:

image

As you can see, if there's a single line in the multiline string, the number of spaces at the beginning is increased (to match the | character's position). The color is also different.
Adding more than one line with the same indentation (even if empty), fixes that.

While the resulting, rendered YAML is valid, it looks odd

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions