I thought that as well and corrected the auto correct and no change. In working shortcodes in the editor the brackets are recognized with color coding. With the leading underscore on this id the closing bracket does not. Good idea though. Thanks
I don’t think this has anything to do with the editor itself, if Hugo isn’t producing the shortcode right and that is valid syntax, then I think the shortcode itself has a bug. You may be able to wrap it in quotes. eg. {{< youtube "_IUHMuBH788" >}} I’m not 100% on that.
Nope. That didn’t work. I created an Apple Shortcut automation to take the clipboard, in this case the Video ID, and insert into a Hugo shortcode and send that back to the clipboard for pasting into Micro.blog.
So, I think I know what the problem is. As the editor is evaluating markdown, it’s disrupting the Hugo shortcode when an underscore appears in the Video ID. As you can see, the close bracket isn’t recognized in the correct Video ID, but if I remove the underscore and eliminate the space between the end of the ID and the close bracket, it is matched, though this also invalidates the Video ID and it won’t go to anything.
Not sure how to get around this with the editor or Hugo.
I successfully used this short code. You need to use a straight quote and not a curly quote.
{{< youtube "_IUHMuBH788" >}}
works.
Straight codes as required, as using an underscore notes the following in the logs:
Error: error building site: assemble: “content/2024/08/20/test-youtube-iuhmubh.md:1:1”: unrecognized character in shortcode action: U+200B. Note: Parameters with non-alphanumeric args must be quoted’’
The U+200B in the log makes me think this is an editor problem after all, because that’s an invisible character (zero-width space) that the editor uses. That should be completely stripped out so something must be wrong. Looking into it, thanks y’all.