Skip to content

Question about attribute names #714

@AndrewLester

Description

@AndrewLester

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions