Plot
Plot copied to clipboard
Replace HTMLAnchorRelationship with RawRepresentable struct
I was recently trying to add some rel=me
links to my site, and noticed that the HTMLAnchorRelationship
was a fixed enum with only a handful of options. I considered adding all of the official attributes to the enum, along with me
, but figured it might be more useful to allow any attribute value to be used.
My PR replaces the enum with a struct that conforms to RawRepresentable
, and includes static properties for all of the attributes from W3C Schools. The change is additive and should be compatible with existing code.
New attributes can be defined by users for their own sites by extending the struct:
extension HTMLAnchorRelationship {
static let me: HTMLAnchorRelationship = "me"
}