linkheader
is a parser for the RFC8288.
- Forgiving parser.
- A link with no "rel" param is not an error.
- A link with many "rel" params is not an error.
- UTF-8 characters outside the US-ASCII range are not an error.
- A link with many "anchor" params is not an error.
- Quoted and unquoted param values are equivalent. E.g.
hreflang=en
is the same ashreflang="en"
. - Collect the link relation type when available.
- Explode to individual links when given a multi-token "rel".
- Change the link context when a valid "anchor" is present.
- Star params (e.g.
title*=UTF-8'en'foo%20bar
) expect a valid RFC8187 value. - Compose relative targets with the given context.
- Collect the "title" param prioritising
title*
when present. - Collect the "hreflang" param.
- Collect the "type" param.
- Collect the "media" param.
- "rev" is not treated specially. It is just another param.
- "rel" values are not validated against the IANA registry.
- Language tags RFC5646 are not parsed.
- RFC8187 values not in UTF-8 are not decoded.
- Media types RFC2046 are not parsed.
- The special (HTML) "rel"
alternate stylesheet
is not handled. Any multi-token "rel" expands to individual links with a different relation type.
linkheader is licensed under the MIT License.