Skip to content

Instantly share code, notes, and snippets.

@kemingy
Created August 6, 2018 15:19
Show Gist options
  • Select an option

  • Save kemingy/b56bb7ae8def20161427cb3211cfd6df to your computer and use it in GitHub Desktop.

Select an option

Save kemingy/b56bb7ae8def20161427cb3211cfd6df to your computer and use it in GitHub Desktop.
escape colon in yaml

How to escape colon in YAML?

This is a bug/feature about YAML parser.

If you want to add something like echo "baseurl: blog/" >> _config.yml, this won't work because colon will be parsed into =>. Even adding quotes around it fails.

To do it, we can split it into two lines.

printf "baseurl:" >> _config.yml
printf " blog/" >> _config.yml

This may seems ugly but helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment