I’m running this blog with Hugo. I love it because it’s super fast and functional, but I had a problem.

Issue example

This is [test](https://example.com), just a [sample](https://sample.test)

This would output…

unnecessary whitespace

like this. It rendered unnecessary space before comma or period.

Cause

It was because layouts/_default/_markup/render-link.html ended with a newline.

What is lender-link.html

It is used with Render Hooks, which overrides default HTML rendering. For example, we can add target="_blank" to external links by using lender-link.html. However, goldmark adds whitespace if the template ends with a newline.

render-link.html of Fuji, the theme I’m using as a base of this blog, ends with no newlines. However, I added a newline to the template by myself when I customize it. Some editor adds a newline of the end automatically, so please be careful…