jgm/commonmark-hs

`attributes` commonmark extension swallows attributes

not-my-profile opened this issue · 2 comments

Explain the problem.

$ printf '{x=3}' | pandoc -f commonmark+attributes -t native
[]
$ printf 'hello\n\n{x=3}' | pandoc -f commonmark+attributes 
<p>hello</p>

If there is nothing the attribute belongs to it is simply swallowed. I find this problematic since this way you are very unlikely to spot such mistakes. I would prefer the markup {x=3} to show up as plain text in the output so that you can spot the error while looking at the rendered output.

Pandoc version?
pandoc 2.16.2 on Linux

jgm commented

This is an issue for jgm/commonmark-hs (commonmark-extensions), if anything.
I can transfer it there. But personally, I think the current behavior is fine.
With the change you recommend, {x=3} would sometimes be an attribute specifier and sometimes plain text, which strikes me as confusing.

Thanks for moving the issue! Well if there is nothing it can be attributed to it's not really an attribute specifier is it?

As far as I am aware any other malformed Markdown ends up in the output instead of being silently discarded. E.g. when TeX math contains an unknown command it's also preserved in the output instead of being silently discarded.