The types API
The types API are you can specify to the rule for attributes and more.
For example, determine the type to allowAttrs
and disallowAttrs
options on the invalid-attr
rule.
{
"invalid-attr": {
"options": {
"allowAttrs": [
{
"name": "any-attr-name",
"value": {
"type": "Boolean"
}
}
]
}
}
}
Markuplint regulates types of attributes by either the below:
Kind of types
Type identifiers
Identifier | Use on | Spec | Supported |
---|---|---|---|
Any | Some attributes | ✅ | |
NoEmptyAny | Some attributes | ✅ | |
OneLineAny | Some attributes | ✅ | |
Zero | Some attributes | ✅ | |
Number | Some attributes | ✅ | |
Uint | Some attributes | ✅ | |
JSON | Attributes on some frameworks etc. | ✅ | |
XMLName | svg|[attributeName] and more | XML | ✅ |
DOMID | The id attribute and more | WHATWG | ✅ |
FunctionBody | Event handler attributes | 🚧 | |
Pattern | input[pattern] | WHATWG | ✅ |
DateTime | time[datetime] and more | WHATWG | ✅ |
TabIndex | The tabindex attribute | WHATWG | ✅ |
BCP47 | The lang attribute and more | RFC | ✅ |
URL | Some attributes | WHATWG | ✅ |
AbsoluteURL | The itemtype attribute (as list) | WHATWG | ✅ |
HashName | img[usemap] | WHATWG | ✅ |
OneCodePointChar | The accesskey attribute (as list) | WHATWG | ✅ |
CustomElementName | The is attribute | WHATWG | ✅ |
BrowsingContextName | Use NavigableTargetName instead. | Obsolated | ✅ |
BrowsingContextNameOrKeyword | Use NavigableTargetNameOrKeyword instead. | Obsolated | ✅ |
NavigableTargetName | iframe[name] and more | WHATWG | ✅ |
NavigableTargetNameOrKeyword | a[target] and more | WHATWG | ✅ |
HTTPSchemaURL | a[ping] (as list) and more | WHATWG | ✅ |
MIMEType | embed[type] and more | WHATWG | ✅ |
ItemProp | The itemprop attribute (as list) | WHATWG | ✅ |
Srcset | img[srcset] and more | WHATWG | ✅ |
SourceSizeList | img[sizes] and more | WHATWG | ✅ |
IconSize | link[sizes] (as list) | WHATWG | ✅ |
AutoComplete | input[autocomplete] and more | WHATWG | ✅ |
Accept | input[accept] | WHATWG | ✅ |
SerializedPermissionsPolicy | iframe[allow] | W3C | ✅ |
<css-declaration-list> | The style attribute | CSS | ✅ |
<class-list> | The class attribute | SVG | ✅ |
<svg-font-size> | Some attributes for SVG | CSS | 🚧 |
<svg-font-size-adjust> | Some attributes for SVG | CSS | 🚧 |
<'color-profile'> | Some attributes for SVG | SVG |