Interaction between emojis and shortcodes' .Inner

I have found an odd interaction between emojis and using shortcodes with {{ .Inner }}. I have a simple shortcode in `layouts/shortcodes/event.html:

<div>{{ "\u29BE" }} {{ .Inner }} </div>

which I use like this:

{{< event >}} 10:30-11:00 My Event {{< /event >}}

It rendered fine (e.g., “⦾ 10:30-11:00 My Event”) until a few days ago when I discovered Hugo supports emojis. When I set enableEmoji = true in config.toml, all of my events rendered like: “⦾ 1000 My Event”.

I guess the emoji processor is capturing :30-11:, and returning an empty string. It’s easy to work around - just add spaces on each side of the hyphen like this: {{< event >}} 10:30 - 11:00 My Event {{< /event >}}, but I’m wondering if it would be reasonable for the original string to be returned.

Note that in markdown lists, this is not a problem. Input of

- 10:30-11:00 My Event

renders as expected regardless of whether enableEmoji is set.

Edit: I’m using Hugo version Hugo Static Site Generator v0.59.1-D5DAB232 windows/amd64 BuildDate: 2019-10-31T15:22:43Z

1 Like