# Empty lines in C++ syntax highlight blocks

**URL:** <https://discourse.gohugo.io/t/empty-lines-in-c-syntax-highlight-blocks/23398>\
**Category:** support\
**Created:** [February 11, 2020, 3:29pm UTC](https://discourse.gohugo.io/t/empty-lines-in-c-syntax-highlight-blocks/23398 "2020-02-11T15:29:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![retif](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/retif/32/8126_2.png) [@retif](https://discourse.gohugo.io/u/retif)\
**Post date:** [February 11, 2020, 3:29pm UTC](https://discourse.gohugo.io/t/empty-lines-in-c-syntax-highlight-blocks/23398/1 "2020-02-11T15:29:25Z")

</div>

Hugo `v0.64.1-C327E75D/extended`. My syntax highlight settings in `config.toml`:

```auto
[markup.highlight]
    codeFences = false
    guessSyntax = false
    hl_Lines = ""
    lineNoStart = 1
    lineNos = false
    lineNumbersInTable = true
    noClasses = true
    style = "abap"
    tabWidth = 4

```

When I write articles, the following code:

```auto
{{< highlight cpp >}}
#pragma once
#include <API.h>
#include <some.h>
#include <vector>

int x = 5;
x = x + 2;

someFunction();
{{< /highlight >}}

```

produces the following result:

 ![cpp](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/c/c588fc66824bc7f785c4f16fc5424f06420c9344.png)

As you can see, redundant empty lines are added (_marked with red on the screenshot_). Here’s what gets generated in HTML:

 ![highlight-cpp](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/c/cb1801036634d327dd31cafc631ef38426693a70.png)

And if I change syntax highlight language from `cpp` to something else:

```auto
{{< highlight csharp>}}
...

```

Then result is the following:

![csharp](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/8/8190271dfd74d427c9c1e00a783e734f49cd5721.png)

So no redundant empty lines. And here’s what gets generated in HTML:

 ![highlight-csharp](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/b/bf97c3400f1b8575fa95b17fe6ecacc2571c6153.png)

So why the difference, why there are redundant empty lines in C++ highlighted code? Is it something that Huge can control somehow?

---

<div class="post-metadata">

**Author:** ![Weru](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/weru/32/7300_2.png) [@Weru](https://discourse.gohugo.io/u/Weru)\
**Post date:** [February 11, 2020, 4:09pm UTC](https://discourse.gohugo.io/t/empty-lines-in-c-syntax-highlight-blocks/23398/2 "2020-02-11T16:09:39Z")

</div>

@retif,

I’m using the same Hugo version and I couldn’t reproduce the behaviour you described above. There’s a very good chance that the issue you’re highlighting is a styling quirk

 ![Screen Shot 2020-02-11 at 7.07.05 PM](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/c/c79f1d5de9cb8e3e4df9464ec803a50a6d1ec60e.png) .

---

<div class="post-metadata">

**Author:** ![retif](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/retif/32/8126_2.png) [@retif](https://discourse.gohugo.io/u/retif)\
**Post date:** [February 11, 2020, 5:28pm UTC](https://discourse.gohugo.io/t/empty-lines-in-c-syntax-highlight-blocks/23398/3 "2020-02-11T17:28:17Z")

</div>

What platform have you tested it on?

My original problem is on Windows/Linux mix: I ran `hugo server` from WSL Ubuntu and viewed the website on the host Windows in Firefox (and Edge).

But now I have now tested it on Mac OS (same version of Hugo), ran `hugo server` from Mac OS terminal and viewed website also on Mac OS in Firefox (and Safari) - the problem isn’t there, I get the same result as on your screenshot.

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [February 11, 2020, 6:46pm UTC](https://discourse.gohugo.io/t/empty-lines-in-c-syntax-highlight-blocks/23398/4 "2020-02-11T18:46:21Z")

</div>

It’s likely an issue of Windows newlines vs Unix newlines. See this previous thread [[SOLVED] Built-in `highlight` function adds whitespace (new lines)](https://discourse.gohugo.io/t/solved-built-in-highlight-function-adds-whitespace-new-lines/19058/13)

---

<div class="post-metadata">

**Author:** ![retif](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/retif/32/8126_2.png) [@retif](https://discourse.gohugo.io/u/retif)\
**Post date:** [February 11, 2020, 7:05pm UTC](https://discourse.gohugo.io/t/empty-lines-in-c-syntax-highlight-blocks/23398/5 "2020-02-11T19:05:07Z")

</div>

Definitely looks like it, although it is still weird why the same lines with the same endings get rendered differently with just a different syntax highlighting language (`csharp` instead of `cpp`, for example).
