commonmark-hs icon indicating copy to clipboard operation
commonmark-hs copied to clipboard

`attributes` commonmark extension swallows attributes

Open not-my-profile opened this issue 3 years ago • 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

not-my-profile avatar Dec 30 '21 08:12 not-my-profile

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.

jgm avatar Dec 30 '21 18:12 jgm

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.

not-my-profile avatar Dec 30 '21 18:12 not-my-profile