patg.net

home

YAML code in Markdown

03 Jul 2014

My friend Brian Aker noticed my post from the other day on Ansible and image building had some things in the YAML Ansible playbooks that looked broken. Sure enough, I didn't notice when proofreading that double {{ and }}

curly braces weren't showing up! That was definite breakage but upon verification of the playbook in my repo, it was not broken and I realized that my markdown in my Jekyll-based github pages website/blog had manged the YAML I inteded to talk about.

Well, this is because Jekyll uses liquid tags and rips these out. The solution? It took me a several attempts, trial-and-error. Some of what I tried:

\{\{ item \}\}

Nope.

\{{ item \}}

Nope.

{{ item }}

Nope.

What is the trick?

Quite simply (and trying to do the below so it's visible was NOT easy!) :

{%raw %}
{{ item }}
{%endraw %}

That's all! There was a link here (hat tip!)

comments powered by Disqus