Hugo

Headings without IDs. Images not in <p> tags

Is it possible to add headings in Hugo/Markdown without it adding any IDs?
Eg, I add ##General Discussion.
I get <h2 id=“general-discussion”>General discussion<h2>
I’d prefer it without the ID element

Also is it possible to add images without them being enclosed in <p> tags?

config.yaml

...
markup:
  goldmark:
    parser:
      autoHeadingID: true

Thanks for that.

However I’m obviously doing something wrong.

This is my config.toml file

baseURL = "http://example.com"
languageCode = "en-us"
title = "Imperox"
theme = "imperox"
pluralizelisttitles = false
sectionPagesMenu = "mainmenu"

[markup]
[markup.goldmark]
    [markup.goldmark.parser]
    attribute = true
    autoHeadingID = false
    [markup.goldmark.renderer]
    hardWraps = false
    unsafe = true
    xHTML = false

I’ve set the following

autoHeadingID = false
unsafe = true

The header ID is still being added.

Thanks again

there is also this setting:

defaultMarkdownHandler: goldmark

also, goldmark was added very recently, are you using the latest hugo version? I think this setting could be set prior to goldmark and the markup config section as well, if you need to use an ancient hugo version.

When I run Hugo version I get this output
Hugo Static Site Generator v0.40.1 linux/amd64 BuildDate: 2018-04-25T17:16:11Z

I git cloned it from the gohugoio/hugo repository. Is this not the latest stable version?

I’ve burnt a few hours on this and I’m going to leave it until tomorrow.

Thanks for your help.

You’re behind a few releases, which would explain why your goldmark markdown config was not taking effect :slight_smile:

For the latest release see https://github.com/gohugoio/hugo/releases

Cool. Thanks zwbetz and budrich.

I updated my version to 0.61.0 and that fixed the heading issue I was having. It hasn’t fixed the images in <p> tags, but I can probably live with that - though it hurts my soul whenever I see them.

regards and thanks for a great product. I’m loving using Hugo so far.

I’ll answer my own question just in case someone else encounters the same issue in regard to images rendering inside <p> tags.

If you use the markdown code for images then they are rendered inside <p> tags.
eg. ![Image](/PATH_TO_IMAGE/IMAGE.jpg) renders as
<p><img src="/PATH_TO_IMAGE/IMAGE.jpg" alt="Images"></p>

However, <img src="/PATH_TO_IMAGE/IMAGE.jpg" alt="Images"> renders clean HTML as follows <img src="/PATH_TO_IMAGE/IMAGE.jpg" alt="Images">

regards