Hugo

Blank space not allowed between link title and link destination in Markdown link syntax (from v0.60.0)

Hello,

This is not much of a tip or trick, just sharing my observation.

I was testing v0.60.0 (Goldmark as the default MD renderer instead of Blackfriday) to see if I can upgrade from v0.54.0.

Some of the Markdown links – [text](URL) – in my project came out as-is in the rendered HTML, instead of proper hyperlinks. It turned out that such parts included blank space in-between, as below:

[text] (URL).

This was rendered properly in v0.54.0, but apparently not in v0.60.0. I’ve removed the blank space and it fixed the problem.

I haven’t tested this against the immediately previous version (v0.59.1), but my hunch is that Goldmark does not allow blank space in between the Markdown link syntax. Otherwise, it might have been one of changes in the intermediate releases.

It would become more clear if one of Hugo maintainers can clarify on this. Hope this helps.

https://spec.commonmark.org/0.29/

4 Likes

@bep, thanks for the pointer. So this must be a change from v0.60.0. Good to know.

An inline link consists of a link text followed immediately by a left parenthesis ( , optional whitespace, an optional link destination, an optional link title separated from the link destination by whitespace, optional whitespace, and a right parenthesis ) . The link’s text consists of the inlines contained in the link text (excluding the enclosing square brackets). The link’s URI consists of the link destination, excluding enclosing <...> if present, with backslash-escapes in effect as described above. The link’s title consists of the link title, excluding its enclosing delimiters, with backslash-escapes in effect as described above.