Skip to content

Instantly share code, notes, and snippets.

@lukehedger
Created August 5, 2014 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukehedger/b273d22ebfd1235f3f7f to your computer and use it in GitHub Desktop.
Save lukehedger/b273d22ebfd1235f3f7f to your computer and use it in GitHub Desktop.
Crazy Mustache syntax highlighting with Liquid/Pygments on Jekyll

To escape double-stashes (as seen in Mustache, Handelbars templates etc) within Liquid/Pygments highlight blocks:

You've got to put this {{ " directly before the opening double-stashes and this " }} directly before the closing double-stashes.

So say you're trying to highlight something like this:

<template attr='{{ value }}'>
    <li>{{ this }}</li>
</template>

Your markdown would look like this:

{% highlight html %}
<template repeat='{{ "{{ arr "}}}}' if='{{ "{{ arrRepeat "}}}}'>
    <li>{{ "{{"}} }}</li>
</template>
{% endhighlight %}

Crazy stuff but somehow it works...

@lukehedger
Copy link
Author

Resource:

This little gem

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