Pygments - extra html getting mixed in

I’m using hugo 0.12. I’ve read elsewhere that there’s an issue that’s causing some pygments rendering problems. I solved part of my problem by indenting highlighted content 4 characters as suggested there. However, I’m still getting extra HTML mixed into the pygments output.

E.g.

{{% highlight yaml %}}
    title: Hugo Incorporated Features
    description: "What's in the box"
    date: 2014-06-19 11:24:00+07:00 

    coverimage: blog-cover.jpg

    excerpt: "Incorporated provides a great typography, responsive design, author details, semantic markup and more."

    authorname: Nicholas Whittier
    authorlink: http://imperialwicket.com
    authortwitter: nw_iw
    authorgithub: imperialwicket 
    authorbio: Some dude.
    authorimage: faces.jpg
{{% /highlight %}}

Results in

<pre><code>title: Hugo Incorporated Features
description: "What's in the box"
date: 2014-06-19 11:24:00+07:00 

coverimage: blog-cover.jpg

excerpt: "Incorporated provides a great typography, responsive design, author details, semantic markup and more."

authorname: Nicholas Whittier
authorlink: http://imperialwicket.com
authortwitter: nw_iw
authorgithub: imperialwicket 
authorbio: Some dude.
authorimage: faces.jpg
</code></pre>

This is all correct, except for the code and pre tags added in for no apparent reason. Does anyone know how to fix this? It appears that hugo is passing that to pygments, because those extra tags are highlighted.

I think that you need to indent the {{% highlight %}} tags at the same level as your code or it won’t quite do what you think.

Highlight with Pygments is a little quirky in 0.12.

This should be fixed in 0.13-DEV, though.

Then you would say

{{< highlight yaml >}}

The {{< indicates that no markdown processing is needed.

@halostatue and @bjornerik

Thanks for your ideas, however I tried both of the formatting changes that you suggested and neither of them seem to have fixed the issue. Would you recommend running 0.13-dev (is it stable enough to not screw things up)?

Also, sorry for kinda abandoning this thread - been busy the past couple weeks.

Edit2: I think I must have sight issues. The suggestion of bypassing markdown processing did in fact work.

Thanks!

Yes, I would recommend going 0.13-dev. I’m running it on 4 sites without issues. No guarantees, though :slight_smile:

Alrighty - I’ll play with it! Worst case scenario I roll back to 0.12 I guess.

Edit: Heh. Can’t get go to compile it. Oh well. I’ll just wait for the release.

Hi All,

I’m facing the same problem @JoshH99 here. Is running the 0.13-DEV the only way to fix this issue? Any idea when 0.13 is about to be released?

Thanks!

ping @spf13

Planning on releasing tonight.

Steve Franciaspf13.com@spf13

1 Like