Hard linebreaks not working in md


#3

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?


#4

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


#5

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


#6

Try https://gohugo.io/commands/hugo_convert/


#7

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

[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.


#8

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


#9

@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?


#10

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.)


#11

@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?


#12

@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!


#13

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.


#14

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


#15

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


#16

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).


#17

@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.


#18

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…


#19

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.


#20

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

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

#21

Hugo’s config command shows that it picks up the config.toml file just fine, see below. Perhaps I should raise an issue here on the hub.

archetypedir: "archetypes" baseurl: "http://example.com/" blackfriday: map[extensions:[hardLineBreak]] builddrafts: false buildexpired: false buildfuture: false cachedir: "/var/folders/hb/f58ybhm518j6zwr7hhrjgjlc0000gn/T/hugo_cache/" canonifyurls: false cleandestinationdir: false contentdir: "content" datadir: "data" defaultcontentlanguage: "en" defaultcontentlanguageinsubdir: false defaultextension: "html" defaultlayout: "post" disable404: false disablelivereload: false disablepathtolower: false disablerobotstxt: false disablerss: false disablesitemap: false enableemoji: false enablegitinfo: false enablemissingtranslationplaceholders: false footnoteanchorprefix: "" footnotereturnlinkcontents: "" forcesyncstatic: false hascjklanguage: false i18ndir: "i18n" ignorecache: false indexes: map[tag:tags category:categories] languagecode: "en-us" layoutdir: "layouts" logi18nwarnings: false metadataformat: "yaml" newcontenteditor: "" paginate: 10 paginatepath: "page" permalinks: map[page:/:title/ about:/:filename/] pluralizelisttitles: true preservetaxonomynames: false publishdir: "public" pygmentscodefences: false pygmentscodefencesguesssyntax: false pygmentsoptions: "" pygmentsstyle: "monokai" pygmentsuseclasses: false relativeurls: false removepathaccents: false rsslimit: 15 rssuri: "index.xml" sectionpagesmenu: "" sitemap: {ChangeFreq: Priority:-1 Filename:sitemap.xml} staticdir: "static" taxonomies: map[tag:tags category:categories] theme: "test" themesdir: "themes" title: "test" uglyurls: false usemodtimeasfallback: false verbose: false watch: false workingdir: "/Users/ae/develop/_web/_hugo/test"


#22

I had the same problem - config.toml wasn’t working. The file was of type CRLF so I set it to LF, and - surprise - all of a sudden it worked.

I then tried to repeat the problem by going back to CRLF and retesting, but it seems to work without any problem as though an imaginary switch (or tmp variable) has been set. Restarted the hugo server, but everything is working as it should.