Hugo

Can I prevent markdownify to introduce 'id' for headers?

I have created the following shortcode to pull release notes from my github repo (very powerful!)

{{ $releases := getJSON "https://api.github.com/repos/pongasoft/jamba/releases?per_page=100" }}
{{ range sort $releases "created_at" "desc"}}
<section class="release-note">
<h3><a href="https://github.com/pongasoft/jamba/tree/{{ .tag_name }}">{{ dateFormat "2006-01-02" .created_at }} - {{ .tag_name }}</a></h3>
{{ .body | markdownify }}
</section>
{{ end }}

In the release notes, I end up having sections like:

## Warning
### The following changes are potentially breaking changes

which when run through markdownify generates the following html

<h2 id="warning">WARNING</h2>

<h3 id="the-following-changes-are-potentially-breaking-changes">The following changes are potentially breaking changes</h3>

Since I have multiple release notes with the same kind of warning, I end up with an html page having multiple tags with the same id…

Is there a way to prevent markdownify to not generate those ids?

Thanks
Yan

Play around with

[blackfriday]
      plainIDAnchors = true

in your configuration. Either true or false add a series of unique characters in the ID attribute.

I think it’s false that you need to use:

Last addendum: Your initial request was how to disable those IDs… that can be done via autoHeaderIds option, same link as above.

Thank you for your answer. I guess I am probably doing it wrong because I cannot make it work…

I added this line to my config.toml file:

autoHeaderIds=false

And it is the same.

I’d put spaces in, see if that helps.

autoHeaderIds = false

It also needs to be nested under:

[blackfriday]

I have tried all suggestions:

[blackfriday]
autoHeaderIds = false

Nothing works… I am wondering if for some reason calling markdownify vs having a .md file which gets processed automatically is somehow the source of the problem… I wished there was a way to invoke markdownify with parameters so that I could just do:

{{ .body | markdownify autoHeaderIds=false }}

Please read Requesting Help and share a repo.