Question

I am using Jekyll (https://github.com/mojombo/jekyll). I don't like to have to write so much just to highlight using Pygment. Currently I have this:

{% highlight bash %}    

$ bash <<( curl https://rvm.io/releases/rvm-install-head)

{% endhighlight bash %}  

I want to be able to do:

highlight :bash do

    $ bash <<( curl https://rvm.io/releases/rvm-install-head)

end

How can I do this?

Was it helpful?

Solution

This is less about Jekyll, and more about the Liquid Templating Engine, which Jekyll uses.

If you really want that feature, the best option is likely to fork Liquid and make the modifications there.

Note, though, that Liquid/Jekyll doesn't just interpret Ruby code. You'll likely have to dig pretty deep into the lexical analysis/parsing to get your example to work correctly without breaking a lot of other things.

OTHER TIPS

I'm not so fond of the liquid templating syntax either. But this textmate snippit (mapped to the tab trigger 'code') makes it a bit less painful.

{% highlight ${1:bash} %}
$2
{% endhighlight %}

Hopefully you can something similar to your text editor of choice.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top