# Hard linebreaks not working in md

**URL:** <https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853>\
**Category:** support\
**Created:** [March 19, 2017, 10:24pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853 "2017-03-19T22:24:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![artelse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/artelse/32/2844_2.png) [@artelse](https://discourse.gohugo.io/u/artelse)\
**Post date:** [March 19, 2017, 10:24pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/1 "2017-03-19T22:24:25Z")

</div>

As I want hard linebreaks between paragraphs in my markdown files, I added `[blackfriday] extensions = ["hardLineBreak"]` to `config.toml`. But, there are no linebreaks rendered in the html. I restarted hugo server and rebuild the site, but no effect.

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 19, 2017, 10:40pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/2 "2017-03-19T22:40:38Z")

</div>

Did you add it to the configuration file or the front matter of your markdown?

```auto
+++
[blackfriday]
  extensions = ["hardLineBreak"]
+++

```

The docs are a bit confusing - the override should be in the markdown.

```auto
It’s possible to set some options for Markdown rendering in a content’s front matter as an override to the BlackFriday rendering options set in your project configuration.

```

---

<div class="post-metadata">

**Author:** ![artelse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/artelse/32/2844_2.png) [@artelse](https://discourse.gohugo.io/u/artelse)\
**Post date:** [March 19, 2017, 11:03pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/3 "2017-03-19T23:03:33Z")

</div>

Does this mean one **needs** to add this option to the frontmatter? Adding it to `config.toml` is not enough? If so, it seems a bit weird adding config stuff to content files…  
How would one write this in yaml?

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 19, 2017, 11:06pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/4 "2017-03-19T23:06:22Z")

</div>

Yes, you must add it to the front matter. I only use TOML, so I can’t help with the YAML equivalent.

---

<div class="post-metadata">

**Author:** ![artelse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/artelse/32/2844_2.png) [@artelse](https://discourse.gohugo.io/u/artelse)\
**Post date:** [March 19, 2017, 11:17pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/5 "2017-03-19T23:17:04Z")

</div>

Hmm, is there a reason we cannot just have a global setting? (Haven’t figured out yet how to express this setting in YAML.

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 19, 2017, 11:56pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/6 "2017-03-19T23:56:10Z")

</div>

Try [https://gohugo.io/commands/hugo\_convert/](https://gohugo.io/commands/hugo_convert/)

---

<div class="post-metadata">

**Author:** ![rdwatters](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rdwatters/32/2848_2.png) [@rdwatters](https://discourse.gohugo.io/u/rdwatters)\
**Post date:** [March 20, 2017, 12:43am UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/7 "2017-03-20T00:43:40Z")

</div>

@artelse This worked fine for me in my `config.toml`

```auto
[blackfriday]
    extensions = [hardLineBreak]

```

This should work across the entire site, although @michael_henderson is right that anything in your front matter will override anything you set in your global/site config. Cheers.

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 20, 2017, 12:48am UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/8 "2017-03-20T00:48:59Z")

</div>

> [@rdwatters](#):
>
> This should work across the entire site

You’re right, it does. I’m not sure why it didn’t seem to earlier. Thanks 🙂

---

<div class="post-metadata">

**Author:** ![artelse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/artelse/32/2844_2.png) [@artelse](https://discourse.gohugo.io/u/artelse)\
**Post date:** [March 20, 2017, 9:05am UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/9 "2017-03-20T09:05:09Z")

</div>

@rdwatters that’s what I would expect, but in my case it refuses to insert line breaks. I also tried your variation to omit `""` around the setting, but that is not allowed of course. So yeah… any ideas how to kick Hugo into expected behavior?

---

<div class="post-metadata">

**Author:** ![rdwatters](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rdwatters/32/2848_2.png) [@rdwatters](https://discourse.gohugo.io/u/rdwatters)\
**Post date:** [March 20, 2017, 1:19pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/10 "2017-03-20T13:19:06Z")

</div>

I can’t reproduce this behavior @artelse. Can you tell me a bit more about your machine, Hugo version, etc.

(And ignore the lack of punctuation from my previous comment; I need to stop responding on my phone.)

---

<div class="post-metadata">

**Author:** ![artelse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/artelse/32/2844_2.png) [@artelse](https://discourse.gohugo.io/u/artelse)\
**Post date:** [March 20, 2017, 6:53pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/11 "2017-03-20T18:53:02Z")

</div>

@rdwatters `Hugo Static Site Generator v0.19 darwin/amd64 BuildDate: 2017-02-27T12:36:32+01:00` on `macOS 10.12.3`. Line endings are `0x0A` standard LF. Any other info that can be helpful?

---

<div class="post-metadata">

**Author:** ![artelse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/artelse/32/2844_2.png) [@artelse](https://discourse.gohugo.io/u/artelse)\
**Post date:** [March 20, 2017, 10:50pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/12 "2017-03-20T22:50:39Z")

</div>

@rdwatters @michael_henderson It appears to be a CSS issue. The CSS framework I use collapsed all margins and paddings on the `p` element to zero. Thanks for the help!

---

<div class="post-metadata">

**Author:** ![rdwatters](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rdwatters/32/2848_2.png) [@rdwatters](https://discourse.gohugo.io/u/rdwatters)\
**Post date:** [March 20, 2017, 10:55pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/13 "2017-03-20T22:55:09Z")

</div>

Cool. Did you check your inspector? The hard line breaks should related to inserting `<br/>` independent of the CSS…just double checking.

For future users, would you mind please adding `[SOLVED]` to the thread title? Cheers.

---

<div class="post-metadata">

**Author:** ![artelse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/artelse/32/2844_2.png) [@artelse](https://discourse.gohugo.io/u/artelse)\
**Post date:** [March 20, 2017, 11:00pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/14 "2017-03-20T23:00:13Z")

</div>

Oh, `<br/>`s have not been inserted… back to the problem then…

---

<div class="post-metadata">

**Author:** ![rdwatters](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rdwatters/32/2848_2.png) [@rdwatters](https://discourse.gohugo.io/u/rdwatters)\
**Post date:** [March 20, 2017, 11:02pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/15 "2017-03-20T23:02:07Z")

</div>

I’m still not able to recreate this issue. Do you happen to have a repo I can look at for local testing please?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [March 20, 2017, 11:02pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/16 "2017-03-20T23:02:28Z")

</div>

Note that the `blackfriday` config can live in both site config and page front matter (page settings will override site). I did it this way before we had multi language, as I needed parts of my site with angled quotes (Norwegian).

---

<div class="post-metadata">

**Author:** ![artelse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/artelse/32/2844_2.png) [@artelse](https://discourse.gohugo.io/u/artelse)\
**Post date:** [March 20, 2017, 11:10pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/17 "2017-03-20T23:10:12Z")

</div>

@rdwatters no repo, am working locally. It shouldn’t matter I am working in my own theme stuff does it? `config.toml` should get the linebreaks working. One other thing, I have Hugo binary not globally installed.

---

<div class="post-metadata">

**Author:** ![rdwatters](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rdwatters/32/2848_2.png) [@rdwatters](https://discourse.gohugo.io/u/rdwatters)\
**Post date:** [March 20, 2017, 11:20pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/18 "2017-03-20T23:20:37Z")

</div>

No it shouldn’t. I only ask because I can’t recreate your issue locally and I too am working with Hugo on macOS. I wanted to see about pulling your repo and running it locally for debugging purposes. I feel like there is something else missing here…

---

<div class="post-metadata">

**Author:** ![artelse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/artelse/32/2844_2.png) [@artelse](https://discourse.gohugo.io/u/artelse)\
**Post date:** [March 20, 2017, 11:41pm UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/19 "2017-03-20T23:41:06Z")

</div>

Interestingly, when I run `hugo --verbose` the first line doesn’t show what config file is loaded:  
`INFO 2017/03/20 23:44:23 Using config file:`  
One would think it doesn’t see the config file, but I can use site variables like `.Site.Title` and they are rendered just fine. So indeed something is wrong here.

---

<div class="post-metadata">

**Author:** ![michael\_henderson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/michael_henderson/32/10490_2.png) [@michael\_henderson](https://discourse.gohugo.io/u/michael_henderson)\
**Post date:** [March 21, 2017, 12:48am UTC](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853/20 "2017-03-21T00:48:27Z")

</div>

I’m on macOS, too. It’s working in both the front matter and the config.toml file.

```auto
<p>first line.<br />
second line.<br />
fourth line.</p>

```

[Next page](https://discourse.gohugo.io/t/hard-linebreaks-not-working-in-md/5853.md?page=2)
