Html code in .md files not working

I have an _index.md file with html code in a folder /content/software/.

I can create links, insert images, etc., using markdown, but the HTML code is ignored when the website is built. For instance:

This works

[a link](http://example.com)

But this does not even appear in the website as a link

<a href="https://example.com">a link</a>

Hugo version: Hugo Static Site Generator v0.60.0
OS: Ubuntu 19.04; linux/amd64
Browser/OS: chromium Version 78.0.3904.108

PS: The problem is not the hugo-academic, apparently (see gcushen/hugo-academic#1454 (comment)) and hugo’s GitHub is not very helpful (https://github.com/gohugoio/hugo/issues/6586)

From Configure markup | Hugo

unsafe
By default, Goldmark does not render raw HTMLs and potentially dangerous links. If you have lots of inline HTML and/or JavaScript, you may need to turn this on.

I personally don’t know all the new Goldmark options, maybe there’s a setting in there for your use. :slight_smile:

This solved it:

[markup]
  [markup.goldmark]
    [markup.goldmark.renderer]
      unsafe = true

which need to go in the ./config/_default/config.toml file.

4 Likes

Welcome to the Hugo discussion forum @diogoferrari. Since this is your first time posting on the Hugo forums I wanted to point out it’s also possible to use other markdown processors, such as Blackfriday, which supports HTML by default.