-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
According to the HTML/XML standard, the keys in data- attributes must be a valid Name, and a Name must consist of at least one character from the NameStartChar class. Thus, the keys must not be empty strings.
Pandoc, however, will generate nonsensical data attributes which trigger validation errors, confuse browser parsers, and can't be queried or used anyway:
$ echo 'Span ("", [], [("","")]) []' | pandoc -f native -w html
<span data-=""></span>
A data-="" is invalid. Pandoc should not generate invalid HTML. I suggest it should either crash on being given invalid Attr data, or omit invalid key-value pairs with a warning.
(I admit this is a silly thing to write, but I did do it today while being a bit mentally confused about Attr vs Target and not thinking about "so what sort of attribute is a ("","") anyway?" and then being rather confused at the sudden outbreak of thousands of validation errors. While perhaps few people would manually write out such a nonsense Attr, it is the sort of thing that could be programmatically generated by other bugs upstream, and Pandoc blocking it is a good thing.)