Markdown not adding a <br> when adding a line break


I can’t seem to add a line break when writing content (markdown).

So, this:

I went to the shop.

The shop was a portal to Hogwarts.

Looks like:

I went to the shop.
The shop was a portal to Hogwarts.

Hugo version:
Hugo Static Site Generator v0.75.1-A4A7BAB7/extended darwin/amd64 BuildDate: 2020-09-15T06:54:33Z


All help appreciated.

In which content file do you have that markdown? Recently Hugo does not parse markdown inside of div and/or span tags. There are config variables you can set and try out:

nofollowLinks = true
noreferrerLinks = true
plainIDAnchors = true
extensions = [
  "laxHtmlBlocks", # laxer block handling... let's see what this does?
  "hardLineBreak", # newlines result in line breaks

The hardLineBreak might do the trick.


Thank you for your response. I don’t have that exact markdown, but all my content files within /blog do not have hardlinebreaks since upgrading to the v0.75.

I was wondering if it was possible to get this working with the new version and Goldmark?

Try the hardLineBreak part in my config sample above. It should be added (with the blackfriday header and extension = []) around line 8 of your config.toml

Sadly, this does not seem to work. I appreciate your help.

Keep in mind that goldmark is now the default renderer. You have to specify blackfriday if you want to be able to use it:

Yes, I tried this but to no avail. I am going to use margin with the article p tag which is not ideal.

Wait a sec. Adding a margin to your p-tag solves the issue? Don’t get me wrong, but that is EXACTLY how this has to be solved. It’s not a hack. If two of these lines are inside of p tags each then the outcome that they don’t have distance (between the p-tags) is a bug in your CSS.

It doesn’t solve the core issue, but it’s a temp solution until I source the real culprit.
I still can’t add linebreaks, which then add a

This is your problem. You are telling paragraphs to NOT have any margin between them. Add a margin-bottom: 1em; (or 2em) and you will see.


I’m not sure this is the problem - it didn’t work.
Should Hard line breaks not result in a

What is the output?

<p>I went to the shop.</p>
<p>The shop was a portal to Hogwarts.</p>


<p>I went to the shop.
The shop was a portal to Hogwarts.</p>

Have you tried setting hardWraps in config.toml?

hardWraps = true

I agree that this is not documented well – I actually had to look in the Markdown processor’s repository to understand what this option does.


This is the best answer.