On our site (which doesn’t use themes, but custom layout from a third party) we’re looking to upgrade from the now quite aged 0.59.1 release.
However our code fence blocks get rendered into HTML really weirdly. The first chunk of code is always OK, but anything after the first blank link gets rendered as multiple <p> elements, sometimes with nested <pre> elements. In these blocks white space isn’t preserved, and the odd nesting of elements also completely messes with our CSS (although I could resolve that).
Bizarrely, if I build a brand new Hugo site and throw the same markdown content at it with any version I’m unable to recreate the problem - each line of code gets the expected <span> element.
As far as I can see we’ve no render-specific options in our config files except for markup.goldmark.renderer.unsafe = true
What could there possibly be in our site’s configuration that causes the code fence output to alter so radically?
markdownify was never a requirement in Hugo templates, it simply:
Runs the provided string through the Markdown processor.
Markdown and HTML are both acceptable content file formats in Hugo, HTML files do not get processed by the Markdown processor and Markdown files can contain raw HTML syntax if the unsafe flag is provided in a project’s config.
Also {{ .Content | markdownify }} is not an incorrect construct per se, it all depends on the project’s context.
Sure - we have plenty of other templates that do pass individual chunks of data (from with, or range, etc) into markdownify. The problematic ones seem to be the ones where the entire .Content derived from a .md file was being processed twice.