Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/debitoor/htmllint-plugin-website

Provides htmllint rules for website.
https://github.com/debitoor/htmllint-plugin-website

Last synced: 12 days ago
JSON representation

Provides htmllint rules for website.

Awesome Lists containing this project

README

        

# htmllint-plugin-website
Provides htmllint rules for website.

This project has been moved to [website-tools/htmllint-plugin-website](https://github.com/debitoor/website-tools/tree/master/packages/htmllint-plugin-website).

## Install
``` bash
$ npm install git+ssh://[email protected]/debitoor/htmllint-plugin-website.git
```

## Usage
``` javascript
import htmllint from 'htmllint';
import htmllintPluginWebsite from 'htmllint-plugin-website';

htmllint.use(htmllintPluginWebsite());

htmllint('', {
'img-src-absolute-path-lowercase': true
});
```

## Rules

### a-href-absolute-path

#### #### a-href-absolute-path-is-known

Checks that a href absolute path is known

```javascript
htmllint('', {
'a-href-absolute-path-is-known': () => true
});
```

default: `false`;

#### a-href-absolute-path-lowercase

Checks that a href absolute path is lowercase

``` javascript
htmllint('', {
'a-href-absolute-path-lowercase': true
});
```

default: `false`;

#### a-href-absolute-path-no-trailing-slash

Checks that the a href absolute path does not have a trailing slash.

``` javascript
htmllint('', {
'a-href-absolute-path-no-trailing-slash': true,
});
```

default: `false`;

#### a-href-absolute-path-starts-with-a-slash

Chcecks that a href absolute path starts with a slash.

``` javascript
htmllint('', {
'a-href-absolute-path-starts-with-a-slash': true
});
```

default: `false`;

### a-href-should

#### a-href-should-not-contain-whitespaces

Checks that a href does not contain any whitespaces

``` javascript
htmllint('', {
'a-href-should-not-contain-whitespaces': true
});
```

### head-link-canonical

#### head-link-canonical-absolute

Checks that head link canonical href is an absolute url.

``` javascript
htmllint('', {
'head-link-canonical-absolute': true
});
```

default: `false`;

#### head-link-canonical-https

Checks that head link canonical href protocol is https.

``` javascript
htmllint('', {
'head-link-canonical-https': true
});
```

default: `false`;

#### head-link-canonical-lowercase

Checks that head link canonical href is lowercase.

``` javascript
htmllint('', {
'head-link-canonical-lowercase': true
});
```

default: `false`;

#### head-link-canonical-required

Checks that head link canonical exists.

``` javascript
htmllint('', {
'head-link-canonical-required': true
});
```

default: `false`;

### head-meta-description

#### head-meta-description-min-length

Checks that head meta description is at least the provided min length.

``` javascript
htmllint('', {
'head-meta-description-min-length': 70
});
```

default: `false`;

#### head-meta-description-max-length

Checks that head meta description is at most the provided max length.

``` javascript
htmllint('', {
'head-meta-description-max-length': 170
});
```

default: `false`;

#### head-meta-description-required

Checks that head meta description exists.

``` javascript
htmllint('', {
'head-meta-description-required': true
});
```

default: `false`;

### img-src-absolute-path

Checks that img src an absolute path.

``` javascript
htmllint('', {
'img-src-absolute-path': true
});
```

default: `false`;

#### img-src-absolute-path-is-known

Checks that img src absolute path is known using the provided function.

``` javascript
const knownUrls = new Set(['https://foo.bar/baz/qux']);

htmllint('', {
'img-src-absolute-path-is-known': (src) => knownUrls.has(src)
});
```

default: `false`;

#### img-src-absolute-path-lowercase

Checks that img src absolute path is lowercase.

``` javascript
htmllint('', {
'img-src-absolute-path-lowercase': true
});
```

default: `false`;

### internal-link

#### internal-link-should-be-absolute-path

``` javascript
htmllint('', {
'internal-link-should-be-absolute-path': () => new RegExp().test()
});
```

default: `false`;

## License

MIT License

Copyright (c) 2017 Debitoor

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.