Is there a way to use Jekyll's Pygments style highlighting

alan's Avatar


11 Oct, 2015 02:29 PM

Hi Brett,

I'm a huge fan of nvAlt and use it write drafts for my Jekyll based blog. In the blog itself, I use the Pygments syntax highlighter. That means instead of using the standard Markdown initial whitespace to identify code blocks, I use Liquid tags. For example:

This line represents some non-code body copy. 

{% highlight ruby %}
# Some Ruby Code Goes Here
{% endhighlight %}

And here's another line that stands in for non-code body copy.

So, the highlight wrappers are at the first character of their lines just like the body copy. Marked treats them just like body copy (which is to be expected). Here's a screenshot example.

Does Marked have the capability of recognizing the liquid pygment tags and displaying them in the same way Jekyll would?

(I see the "Custom Processor" and "Preprocessor" under Preferences -> Advanced. I suspect I can use the Preprocessor to transform the liquid code block. Before I start messing with that, I figure I'd check and see if there was a built-in way that I'm missing.)



  1. Support Staff 1 Posted by Brett on 11 Oct, 2015 04:52 PM

    Brett's Avatar

    A custom processor is ideal:

    That script handles replacement of liquid tags and uses kramdown to render (which could be replace with whatever processor your Jekyll install uses). You could pass the fenced code blocks out to pygments in the "fenced code" gsub block if you prefer.


  2. 2 Posted by alan on 11 Oct, 2015 10:51 PM

    alan's Avatar

    Right on. Thanks! I'll dig into that.


    Alan W. Smith
    @TheIdOfAlan <>

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac