From the spec, an attribute name must start with an ASCII letter, _, or :.
The way this is implemented can lead to different results in parsing (as far as I can tell, though I may be wrong). Take two p tags with invalid attributes named --foo, one inline and one as a block:
Inline: https://spec.commonmark.org/dingus/?text=inline%3A%20%3Cp%20--q%3D%22hi%22%20%2F%3E
Block: https://spec.commonmark.org/dingus/?text=%3Cp%20--q%3D%22hi%22%20%2F%3E
The inline example parses as text, presumably(?) because the attribute name isn't valid. The block example, on the other hand, parses as an HTML block with the attribute intact.
Regardless of all this, I was just wondering why attribute names can only start with those specific characters.
From the spec, an attribute name must start with an ASCII letter,
_, or:.The way this is implemented can lead to different results in parsing (as far as I can tell, though I may be wrong). Take two
ptags with invalid attributes named--foo, one inline and one as a block:Inline: https://spec.commonmark.org/dingus/?text=inline%3A%20%3Cp%20--q%3D%22hi%22%20%2F%3E
Block: https://spec.commonmark.org/dingus/?text=%3Cp%20--q%3D%22hi%22%20%2F%3E
The inline example parses as text, presumably(?) because the attribute name isn't valid. The block example, on the other hand, parses as an HTML block with the attribute intact.
Regardless of all this, I was just wondering why attribute names can only start with those specific characters.