cancel
Showing results for 
Search instead for 
Did you mean: 
senior
Cadet
Cadet
  • 2,041 Views

Add color to text in YAML

I am creating YAML file with some colored text in between. Not sure how to add colored text in the file. Any suggestions?

Labels (2)
2 Replies
Fran_Garcia
Starfighter Starfighter
Starfighter
  • 2,038 Views

YAML is a text-only file, meaning it doesn't support special rendering codes. If you want to highlight parts of your code, you can use an editor that is able to automatically highlight YAML syntax, such as VIM, VSCode or any other modern editor.

 

If you are trying to embbed color codes as a part of a script/playbook/etc, it depends on how that string is used and how it is parsed (but that would be a very uncommon usecase and really not your original question). 

How do you intend to use the colored text?

senior
Cadet
Cadet
  • 2,037 Views

So, it is latter.

I want to highlight some text in red in document generated from yaml. Not
sure how can I do that formatting in yaml file itself.
Join the discussion
You must log in to join this conversation.