HTML generated from markdown ignores indentation

I’m using Hugo to generate HTML templates that others will likely need to read and edit in future without having access to my Hugo dev environment. As such clean formatting of the HTML outputs is quite important.

For the most part everything is fine, expect for HTML elements that are generated from a markdown file and called via {{ .Content }} seem to ignore the indentation. Strangely enough the first element in the markdown file is indented correctly, but anything following that does not.

See here, the H2 is indented, but the following paragraph and list elements are not:

Markdown content used to generate the HTML:

## {{<towncity>}}'s **top choice** for fast vehicle recovery &amp; towing

We have the means to safely collect and deliver almost **any vehicle** to **any location** in {{<county>}} and the UK thanks to our fleet recovery trucks. Whether you need to move a van, car, or motorbike we are your **number one choice**.

+ Years of towing and haulage experience nationwide
+ A reputation for fast delivery times and reliability
+ Competitive and affordable rates

I suspect this is an issue with Goldmark rather than Hugo itself, but I was wondering if I’m doing something wrong? Perhaps there’s a config setting I should look into?

No, this is how it is. It has been discussed adding a HTML formatter as an option, but noone has come up with an implementation that’s both correct and fast.

Ah, that’s a shame. It would be nice to avoid having to format the HTML manually after building but I suspected the issue would have been resolved already if a solution existed. Thanks.

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