Why is my Literal Style being replaced by Folded Style?

If I format my yaml like this:

target:
  entity_id: input_number.cost_today
    data:
      value: |
        {{ (float(states('sensor.smart_meter_electricity_import_standing_charge')) +
            float(states('input_number.cost_today_night_component')) ) | round(2) }}

Save and reopen the Automation, it is reformatted like this:

target:
  entity_id: input_number.cost_today
data:
  value: >
     {{
     (float(states('sensor.smart_meter_electricity_import_standing_charge'))
     +
          float(states('input_number.cost_today_night_component')) ) | round(2) }}

The pipe “|” (literal) has changed to a “greater than” (folded) styles.
This is not universal across my code! I know yaml in images is frowned upon, but I wish to show you this:


The top pipe “|” is retained the bottom one is replaced. Why?

Regards, Martin

1 Like

Are you saving this as a .yaml file or copy/pasting into the UI and saving there?

I am editing (I guess that it is /homeassistant/automations.yaml) from within the Settings > Automation > Edit as YAML GUI.
Close Edit as YAML and reopen again.

Regards, M.

That YAML is re-generated every time, so your own style is ignored.
That’s also why comments are not preserved.

But why is one section’s formatting retained but not the other?