# Is a linebreak in the html between list elements normal?

**URL:** <https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589>\
**Category:** support\
**Created:** [January 19, 2026, 9:23pm UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589 "2026-01-19T21:23:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Durand](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tom_durand/32/14460_2.png) [@Tom\_Durand](https://discourse.gohugo.io/u/Tom_Durand)\
**Post date:** [January 19, 2026, 9:23pm UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589/1 "2026-01-19T21:23:21Z")

</div>

Hi, I write a quick typing course, so obviously I am very, very sensitive and nitpicky about typography. Literally every line break or space matters.  
So I tend to use related properties or that kind of thing pretty liberally.  
And I notice that “white-space-collapse:preserve-breaks” (as well values nowrap, pre, pre-line, pre-wrap, break-spaces) show that behavior, visually introducing a new line (so, two line breaks in a row) between list elements.  
The html code shows only a line-break. So it’s like the browser stacks that plus the normal list element line-returning behavior.  
But this quirk irks me, the line break in the markdown meant to separate the list element, obviously, not introduce a literal line-break in the html code… and on top of that, minifying plain doesn’t work.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/0/1/014a7126eb8340778283ed3c5ee06e7d8be39ff6.png)

---

<div class="post-metadata">

**Author:** ![frjo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/frjo/32/18626_2.png) [@frjo](https://discourse.gohugo.io/u/frjo)\
**Post date:** [January 20, 2026, 7:36am UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589/2 "2026-01-20T07:36:32Z")

</div>

A link to the site, or better yet a link to the code repo would help a lot in figuring this out.

Guessing, I would look in to the theme css or render hooks.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [January 20, 2026, 4:00pm UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589/3 "2026-01-20T16:00:39Z")

</div>

As @frjo pointed out, the markdown sources and generated html + CSS is the key.

- **First** : Markdown source , guess you are aware of the differences of

- **Second** : Browser default without any CSS  
HTML does not target appealing layout - it is a content structure. And it looks readable without any CSS. All Browsers add some styling – nowadays exposed as (css) styles – , around the different tags `<ul>, <li>, <p>` …  
Check the computed styles with DEV Tools without using any own CSS. The result will be browser dependent. If you don’t like that, you will have to override these settings, some even apply a CSS reset (search for it) to kill all browser influence.

- **Third** : own CSS styling  
Will add/change the stuff - again use DEV tools to see the effects and figure out which rules adds something, especially with these _white-space-collapse_ settings and/or minification.

- **Fourth** : There might be still some differences between different Browsers in some situation and or for some tags …

---

<div class="post-metadata">

**Author:** ![Tom\_Durand](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tom_durand/32/14460_2.png) [@Tom\_Durand](https://discourse.gohugo.io/u/Tom_Durand)\
**Post date:** [January 20, 2026, 6:54pm UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589/4 "2026-01-20T18:54:47Z")

</div>

Yes I know how to put paragraphs inside a list, and it is not it. Browsers behave identically, and no weird markup appears in the code. However, like I said, a linebreak is introduced by Goldmark/hugo, of which white-space:pre/pre-wrap/pre-line causes the literal interpretation.  
Here’s a repo: [GitHub - evanescente-ondine/hugo-sample](https://github.com/evanescente-ondine/hugo-sample.git)  
First time in my life I managed to set up a repo ever, houra.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 20, 2026, 8:09pm UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589/5 "2026-01-20T20:09:35Z")

</div>

> [@Tom\_Durand](#):
>
> a linebreak is introduced by Goldmark/hugo

I’m not sure what that means. Our Markdown interpreter (Goldmark) is doing exactly what it should be doing per the CommonMark specification.

Try it:  
[https://spec.commonmark.org/dingus/?text=List -%20item -%20item](https://spec.commonmark.org/dingus/?text=List%0A%0A-%20item%0A-%20item%0A%0A)

This:

```plaintext
List

- item
- item

```

Is rendered to this:

```html
<p>List</p>
<ul>
<li>item</li>
<li>item</li>
</ul>

```

If you minify your build it looks like this:

```html
<p>List</p><ul><li>item</li><li>item</li></ul>

```

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [January 20, 2026, 8:36pm UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589/6 "2026-01-20T20:36:37Z")

</div>

I took the htdocs/index.html and opened it directly in Chrome. As I said NO CSS → Browser Style

No blank line but margins added.

Sometimes a picture helps:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/b/e/be211581dc1fd19743c77633fe89336ca8166817.png)

p.s.

> [@jmooring](#):
>
> Try it:  
> [https://spec.commonmark.org/dingus/?text=List -%20item -%20item](https://spec.commonmark.org/dingus/?text=List%0A%0A-%20item%0A-%20item%0A%0A)

exactly where I verified my **first** point

p.s.

> [@Tom\_Durand](#):
>
> Browsers behave identically

These days it’s much better but still some quirks out there (edge shows the same values. … both use the same browser engine, dunno how firefox or safire will do)

---

<div class="post-metadata">

**Author:** ![Tom\_Durand](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tom_durand/32/14460_2.png) [@Tom\_Durand](https://discourse.gohugo.io/u/Tom_Durand)\
**Post date:** [January 20, 2026, 9:38pm UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589/7 "2026-01-20T21:38:19Z")

</div>

Ok, I get it. Then it bothers me that the minifier (works now, go figure) removes newlines and double spaces and tabulations alike, both inside and outside tags. But I like and use tabulations in particular, which don’t get their own html elements unlike linebreaks except inside `<pre>` ☹  
Is there any way to preserve tabs ? The actual Tab character is unlikely to be outputed by programs and much more likely by users, so why touch it…

---

<div class="post-metadata">

**Author:** ![chrillek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/chrillek/32/19797_2.png) [@chrillek](https://discourse.gohugo.io/u/chrillek)\
**Post date:** [January 21, 2026, 7:30am UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589/8 "2026-01-21T07:30:08Z")

</div>

Whitespace is often meaningless in HTML, especially between elements.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [January 21, 2026, 10:33am UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589/9 "2026-01-21T10:33:02Z")

</div>

mmh, I suppose that is even handled before minify by the Markdown engine.

There’s no concept as indenting lines in a paragraph using spaces or tabs in Markdown as in the good old typewriter _paper_ writing.

> [Common mark Spec # TABS](https://spec.commonmark.org/0.31.2/#tabs)  
> Tabs in lines are not expanded to [spaces](https://spec.commonmark.org/0.31.2/#space). However, in **contexts where spaces help to define block structur** e, **tabs behave as if they were replaced by spaces** with a tab **stop of 4 characters**.
> 
> Thus, for example, a tab can be used instead of four spaces in an indented code block. (Note, however, that internal tabs are passed through as literal tabs, not expanded to spaces.)

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [January 23, 2026, 10:33am UTC](https://discourse.gohugo.io/t/is-a-linebreak-in-the-html-between-list-elements-normal/56589/10 "2026-01-23T10:33:28Z")

</div>

Closed on January 23, 2026, 10:33am UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
