How to escape indicator characters (i.e. : or - ) in YAML

后端 未结 7 2268
醉话见心
醉话见心 2020-11-27 12:13

In a config file, I have a key to which I wish to assign a URL. The problem is that YAML interprets : and - characters as either creating mappings or lists, so it has a pro

7条回答
  •  生来不讨喜
    2020-11-27 12:22

    What also works and is even nicer for long, multiline texts, is putting your text indented on the next line, after a pipe or greater-than sign:

    text: >
        Op dit plein stond het hoofdkantoor van de NIROM: Nederlands Indische 
        Radio Omroep
    

    A pipe preserves newlines, a gt-sign turns all the following lines into one long string.

提交回复
热议问题