Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
html-w3c-validator
Advanced tools
CLI for validating HTML pages using validator.w3.org.
html-w3c-validator is a CLI tool to validate HTML pages using validator.w3.org.
You might use a JavaScript framework or simply use HTML but you should always validate your production HTML and this validation should be part of your CI/CD pipeline (tests, linting, etc.).
Quote from https://validator.w3.org/docs/help.html#why-validate:
One of the important maxims of computer programming is: "Be conservative in what you produce; be liberal in what you accept."
Browsers follow the second half of this maxim by accepting Web pages and trying to display them even if they're not legal HTML. Usually this means that the browser will try to make educated guesses about what you probably meant. The problem is that different browsers (or even different versions of the same browser) will make different guesses about the same illegal construct; worse, if your HTML is really pathological, the browser could get hopelessly confused and produce a mangled mess, or even crash.
You can combine html-w3c-validator with start-server-and-test to validate HTML pages of your project.
Node.js >= 16.0.0
npm install --save-dev html-w3c-validator start-server-and-test
package.json
{
"scripts": {
// Command to start the server serving your HTML pages (e.g: using vercel/serve)
"start": "serve \"./build\"",
// Command to validate your HTML pages
"test:html-w3c-validator": "start-server-and-test \"start\" \"http://127.0.0.1:3000\" \"html-w3c-validator\"",
},
}
.html-w3c-validatorrc.json
{
"$schema": "./node_modules/html-w3c-validator/schema/schema.json",
// URLs to validate.
"urls": ["http://127.0.0.1:3000/", "http://127.0.0.1:3000/about"],
// Files to validate.
"files": ["./index.html", "./about.html"],
// Specify the severities of the validator messages to report. (default: ["warning", "error"])
"severities": ["info", "warning", "error"],
}
node --run test:html-w3c-validator
Example of output (in case of success):
✔ Validating http://127.0.0.1:3000/
✔ Validating http://127.0.0.1:3000/about
Success: HTML validation (W3C) passed! 🎉
See the ./example folder for practical usage.
--current-working-directory <path> The current working directory (default: `process.cwd()`).
-V, --version Output the version number.
-h, --help Display help for command.
Anyone can help to improve the project, submit a Feature Request, a bug report or even correct a simple spelling mistake.
The steps to contribute can be found in the CONTRIBUTING.md file.
FAQs
CLI for validating HTML pages using validator.w3.org.
The npm package html-w3c-validator receives a total of 105 weekly downloads. As such, html-w3c-validator popularity was classified as not popular.
We found that html-w3c-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.