w3c-html-validator 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -6
- package/bin/cli.js +0 -17
- package/dist/w3c-html-validator.d.ts +1 -1
- package/dist/w3c-html-validator.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -20,7 +20,14 @@ $ npm install --save-dev w3c-html-validator
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## B) Usage
|
|
23
|
-
### 1.
|
|
23
|
+
### 1. Synopsis
|
|
24
|
+
```
|
|
25
|
+
html-validator [INPUT1] [INPUT2] [INPUT3] [...]
|
|
26
|
+
```
|
|
27
|
+
Parameters:
|
|
28
|
+
Each parameter is a folder or file to be sent to the HTML validator.
|
|
29
|
+
|
|
30
|
+
### 2. npm package.json scripts
|
|
24
31
|
Run `html-validator` from the `"scripts"` section of your **package.json** file.
|
|
25
32
|
|
|
26
33
|
The parameters are folders and files to be validated.
|
|
@@ -37,7 +44,7 @@ Example **package.json** scripts:
|
|
|
37
44
|
Passing no parameters defaults to validating all HTML files in the project (skipping the
|
|
38
45
|
**node_modules** folder).
|
|
39
46
|
|
|
40
|
-
###
|
|
47
|
+
### 3. Command-line npx
|
|
41
48
|
Example terminal commands:
|
|
42
49
|
```shell
|
|
43
50
|
$ npm install --save-dev w3c-html-validator
|
|
@@ -47,7 +54,7 @@ The above `npx` line validates all the HTML files in the **docs** folder.
|
|
|
47
54
|
|
|
48
55
|
You can also install **w3c-html-validator** globally (`--global`) and then run it anywhere directly from the terminal.
|
|
49
56
|
|
|
50
|
-
###
|
|
57
|
+
### 4. CLI flags
|
|
51
58
|
Command-line flags:
|
|
52
59
|
| Flag | Description | Value |
|
|
53
60
|
| ----------------- | ------------------------------------------------------------------- | ---------- |
|
|
@@ -62,7 +69,7 @@ Command-line flags:
|
|
|
62
69
|
| `--quiet` | Suppress messages for successful validations. | N/A |
|
|
63
70
|
| `--trim` | Truncate validation messages to not exceed a maximum length. | **number** |
|
|
64
71
|
|
|
65
|
-
###
|
|
72
|
+
### 5. Examples
|
|
66
73
|
- `html-validator`<br>
|
|
67
74
|
Validates all HTML files in the project.
|
|
68
75
|
|
|
@@ -92,7 +99,7 @@ Command-line flags:
|
|
|
92
99
|
|
|
93
100
|
_**Note:** Single quotes in commands are normalized so they work cross-platform and avoid the errors often encountered on Microsoft Windows._
|
|
94
101
|
|
|
95
|
-
###
|
|
102
|
+
### 6. Configuration File for Ignore Patterns
|
|
96
103
|
The optional `--ignore-config=FILENAME` flag specifies a configuration file with one string or regex per line.
|
|
97
104
|
HTML validation messages containing any of the strings or matching any of the regexes will be skipped.
|
|
98
105
|
Empty lines and lines starting with a hash sign (`#`) are treated as comments and do nothing.
|
|
@@ -108,7 +115,7 @@ Example configuration file with 3 regexes:
|
|
|
108
115
|
The caret (`^`) regex operator says to match from the beginning of the validation message.
|
|
109
116
|
The dot (`.`) regex operator says to match any one character, which is a handy way to avoid typing the special curly quote characters in some of the validation messages.
|
|
110
117
|
|
|
111
|
-
###
|
|
118
|
+
### 7. Default Ignore List
|
|
112
119
|
The optional `--default-rules` flag causes HTML validation messages to be skipped if they are on the opinionated pre-defined list of unhelpful messages.
|
|
113
120
|
|
|
114
121
|
Default ignore list:
|
package/bin/cli.js
CHANGED
|
@@ -4,23 +4,6 @@
|
|
|
4
4
|
// MIT License //
|
|
5
5
|
////////////////////////
|
|
6
6
|
|
|
7
|
-
// Usage in package.json:
|
|
8
|
-
// "scripts": {
|
|
9
|
-
// "validate": "html-validator docs flyer.html",
|
|
10
|
-
// "all": "html-validator"
|
|
11
|
-
// },
|
|
12
|
-
//
|
|
13
|
-
// Usage from command line:
|
|
14
|
-
// $ npm install --save-dev w3c-html-validator
|
|
15
|
-
// $ npx html-validator dist #validate all html files in the dist folder
|
|
16
|
-
// $ npx html-validator docs flyer.html
|
|
17
|
-
//
|
|
18
|
-
// Contributors to this project:
|
|
19
|
-
// $ cd w3c-html-validator
|
|
20
|
-
// $ npm install
|
|
21
|
-
// $ npm test
|
|
22
|
-
// $ node bin/cli.js spec --continue
|
|
23
|
-
|
|
24
7
|
import { w3cHtmlValidator } from '../dist/w3c-html-validator.js';
|
|
25
8
|
|
|
26
9
|
w3cHtmlValidator.cli();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//! w3c-html-validator v2.0.
|
|
1
|
+
//! w3c-html-validator v2.0.2 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
|
|
2
2
|
|
|
3
3
|
import { cliArgvUtil } from 'cli-argv-util';
|
|
4
4
|
import { globSync } from 'glob';
|
|
@@ -8,7 +8,7 @@ import log from 'fancy-log';
|
|
|
8
8
|
import request from 'superagent';
|
|
9
9
|
import slash from 'slash';
|
|
10
10
|
const w3cHtmlValidator = {
|
|
11
|
-
version: '2.0.
|
|
11
|
+
version: '2.0.2',
|
|
12
12
|
defaultIgnoreList: [
|
|
13
13
|
'Section lacks heading.'
|
|
14
14
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "w3c-html-validator",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Check the markup validity of HTML files using the W3C validator",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"chalk": "~5.6",
|
|
61
61
|
"cli-argv-util": "~1.3",
|
|
62
62
|
"fancy-log": "~2.0",
|
|
63
|
-
"glob": "~
|
|
63
|
+
"glob": "~12.0",
|
|
64
64
|
"slash": "~5.1",
|
|
65
65
|
"superagent": "~10.2"
|
|
66
66
|
},
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
"add-dist-header": "~1.6",
|
|
73
73
|
"assert-deep-strict-equal": "~1.2",
|
|
74
74
|
"copy-file-util": "~1.3",
|
|
75
|
-
"copy-folder-util": "~1.
|
|
75
|
+
"copy-folder-util": "~1.2",
|
|
76
76
|
"eslint": "~9.39",
|
|
77
77
|
"jshint": "~2.13",
|
|
78
78
|
"mocha": "~11.7",
|
|
79
79
|
"rimraf": "~6.1",
|
|
80
80
|
"run-scripts-util": "~1.3",
|
|
81
81
|
"typescript": "~5.9",
|
|
82
|
-
"typescript-eslint": "~8.
|
|
82
|
+
"typescript-eslint": "~8.47"
|
|
83
83
|
}
|
|
84
84
|
}
|