Do you have a space between the {{ and the % characters? That space is in the example because of a quirk with the Hugo rendering - it shouldn’t be in your markdown.
With v0.12, the following works (where the dots are replaced with spaces):
{{% highlight html %}}
....<p> ciao </p>
{{% /highlight %}}
As @bjornerik said, you have to indent the code by 4 to prevent Markdown from changing the HTML. In your markdown, you wouldn’t fence in the code using backticks, either.
I confirm that now pygmetize works with the highlight html example.
When I try to render a c snippet of code, with a default theme like herring-cove or hyde, the rendering is not correct: the braces and the variable name in the declaration are missing:
## some demo code
{{% highlight c %}}
int c;
if(c) {
return c;
}
{{% /highlight %}}
render like this:
some demo code
int
if
return
Do you know if there are themes or recipes to make it work with c language?
Attilio, I ran the same but got different results. This is with v0.12 on a Mac.
I created the highlights file.
$ cat content/post/sample.md
+++
date = "2014-12-02T10:51:45-06:00"
draft = true
title = "sample"
+++
## some demo code
{{% highlight c %}}
int c;
if(c) {
return c;
}
{{% /highlight %}}
$
Ran the server.
$ hugo --buildDrafts server
1 of 1 draft rendered
0 future content
1 pages created
0 tags created
0 categories created
in 105 ms
Serving pages from /Volumes/G-DRIVE Data/Sites/playground/public
Web Server is available at http://localhost:1313
Press ctrl+c to stop
The html is ok, the problem is just a “wrong” stylesheet setting.
I’m just learning hugo, so I dont know if this is the best way, but changing the pre.background-color into hyde theme poole.css:
pre {
...
background-color: #424242;
}
resolve the problem.
The only thing to note is that each pygment language style could have different color setting, so the tuning must be done for each highlighted language.
maybe config options pygmentsstyle is the right way, but I’m actually not able to understand how it works.