gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
76.12k stars 7.54k forks source link

Improve validation for Markdown attributes #10835

Open bep opened 1 year ago

bep commented 1 year ago

See https://discourse.gohugo.io/t/passing-attributes-to-render-hook-error-is-silently-ignored/43430

deining commented 1 year ago

I got aware of #10836 which is supposed to fix this issue, thanks for your action here.

I tested it locally (with hugo built from HEAD of repo) and ran into this issue:

```myblock { attrib1="{" }

This worked with hugo `v0.111.3`, but with `v0.112.0-DEV` I'm now getting:

Error: Error building site: "C:\path\to\index.md:21:23": failed to parse Markdown attributes; you may need to quote the values


Same for:


**Expected behaviour**: Validation shouldn't fail since the value `}` for `attrib1` is properly enclosed into double quotes.
johannesengl commented 1 year ago

@deining Could you please clarify for your examples above what the expected behaviour would be? I assume myblock { attrib1="{" } should be valid since it contains properly quoted values?

deining commented 1 year ago

Just realized that an empty attributes block causes issues too:

```myblock { }

This results in:

Error: Error building site: "C:\path\to\index.md:nn:mm": failed to parse Markdown attributes; you may need to quote the values