Illegal shortcode state when using escaped quotes in shortcode arguments

I have a site with a page mypage.md, a part of the page looks like:

...
{{< myshortcode foo="![alttext](foobar.png \"mouse over text\")" bar="quz" >}}
...

This code worked flawlessly with hugo v0.101.0.

Now, after upgrading to hugo v0.102.1, hugo server doesn’t startup any more. The error is Illegal shortcode state:

Start building sites … 
hugo v0.102.1-e9c3ce16abc391ee5be38f88b0499d0e8e19104c+extended linux/amd64 BuildDate=2022-08-29T12:58:13Z VendorInfo=gohugoio
Error: Error building site: "/home/user/example/content/mypage.md:28:1": Illegal shortcode state

I could work around this by using single quotes instead of escaped double quotes:

...
{{< myshortcode foo="![alttext](foobar.png 'mouse over text')" bar="quz" >}}
...

I still don’t understand the reason for the failure, though.

1 Like

I ran into the same thing upgrading from 0.101.0 (Mac), but I couldn’t distill it down to a simple repeat-by; the test cases I came up with all worked. Since it only affected one MD file out of 5,000+ for my site, I just changed the quotes in that one.

https://github.com/gohugoio/hugo/issues/10236

4 posts were split to a new topic: Shortcode error

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