Flexible appending new data to yaml files

You can use PyYAML’s low-level event interface. Assuming you have an input YAML file and want to write the modifications to an output YAML file, you can write a function that goes through PyYAML’s generated event stream and inserts the requested additional values at the specified locations: import yaml from yaml.events import * class AppendableEvents: … Read more

How do you do block comments in YAML?

YAML supports inline comments, but does not support block comments. From Wikipedia: Comments begin with the number sign ( # ), can start anywhere on a line, and continue until the end of the line A comparison with JSON, also from Wikipedia: The syntax differences are subtle and seldom arise in practice: JSON allows extended … Read more

Insert a logo in upper right corner of R markdown pdf document

You can use the includes option in the yaml to specify a custom addition to your latex header. The yaml part would look like — output: pdf_document: keep_tex: true includes: in_header: header.tex — and you need to save a separate file called header.tex with the following defining your company logo like so: \usepackage{fancyhdr} \pagestyle{fancy} \rhead{\includegraphics[width … Read more