Extra line break when rendering links

I’m running hugo 0.69.0 and just noticed that html links are not rendering properly if they have a class assigned.

For example, this:

<a class="btn btn-primary" href="https://example.com/" role="button">https://example.com/</a>

Renders to this:

<p><a class="btn btn-primary" href="https://example.com/" role="button"></a><a href="https://example.com/">https://example.com/</a></p>

I have even double checked the config settings for goldmark to see what could be happening, but it seems to be in order:

[markup]
  [markup.goldmark]
    [markup.goldmark.extensions]
      definitionList = true
      footnote = true
      linkify = true
      strikethrough = true
      table = true
      taskList = true
      typographer = true
    [markup.goldmark.parser]
      attribute = true
      autoHeadingID = true
    [markup.goldmark.renderer]
      hardWraps = false
      unsafe = true
      xHTML = false

Has anyone had a similar problem?

set linkify to false

 [markup.goldmark.extensions]
  linkify = false

EDIT: Ehh waitt i’m confused what’s the problem actually? the line break wrap to <p></p> or because the <a> element rendered twice?

EDIT2: But here’s how to remove that <p></p> wrap.
you can write it like this.

<!----><a class="btn btn-primary" href="https://example.com/" role="button">https://example.com/</a>

As far as I experienced, Hugo doesn’t like it when I put normal HTML in my markdown. It suggests me to use create a short code instead and use that.

The problem isn’t the paragraph, it’s the extra <a> tag that shows up in the html.

And you were right, setting linkify to false fixed it :slightly_smiling_face:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.