Passing attributes to render hook: error is silently ignored

During development, I came across an issue that I would like to report an discuss:

I authored a custom render hook for a code block. Then I used this code block in my page and passed attributes to the newly created render hook:

```my-customblock { color=red dimensions=XL }
BODY
```

With this code, a filled map is correctly passed to my render hook (accessible via .Attributes):

map[color:red dimensions:XL] 

However, using this code

```my-customblock { color=red dimensions=300x200 }
BODY
```

an empty map is passed to my render hook:

map[] 

This was unexpected, I soon realized that you have to quote the value 300x200 in order to make it work:

```my-customblock { color="red" dimensions="300x200" }
BODY
```

Now my issue: I consider discarding given values and passing an empty map as error, but currently hugo silently ignores this error situation. IMHO hugo should be more strict here and emit an error (or at least a warning). No idea if this is something that can be achieved easily. WDYT?

Some of this may be inherited from the GoldMark markdown library we use, but I suspect that we should be able to improve on this. I suspect that the original motivation was something in the line of “if it does not parse as an attribute block, then it’s something else …”.

1 Like