Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for an offline version of the official W3C HTML validator #4827

Open
w0rp opened this issue Sep 1, 2024 · 0 comments
Open

Add support for an offline version of the official W3C HTML validator #4827

w0rp opened this issue Sep 1, 2024 · 0 comments
Labels
new tool Support for new linters, fixers, etc.

Comments

@w0rp
Copy link
Member

w0rp commented Sep 1, 2024

Name: w3c-html-validator
URL: https://validator.w3.org/

Background

W3C have an officlial and very strict HTML validator available online here. For HTML there exist in the wild two primary types of HTML linters.

  1. Offline tools that have a set of rules that sometimes coincide with the official W3C validation tool.
  2. Validator tools that send network requests to the official W3C validator.

The problem with each type of linter is that on the one hand you cannot be sure your HTML files will pass all posssible W3C validator checks, and on the other hand if the validator happens to be offline on a particular day you cannot reliable check your files for validation, and you certainly cannot rely on that validation as you type or when your network connection fails. HTML validation tools such as W3C are important for algorithms such as PageRank for Google and SEO, and provide very strong guarantees that your websites will render correctly in all browsers. (Not certain, but very good.)

Some clever people (including yours truly) have figured out that you can install the W3C validation Perl script designed for CGI available here on many systems and you will end up with a validator installed in locations such as /usr/lib/cgi-bin/w3c-markup-validator/check. If you figure out how to craft an HTTP payload to send to that Perl script such as this then you can pull out of the output of the Perl script the data required.

The Plan

We should publish a script or program under the Dense Analysis licence with a Docker image available on Docker Hub for running the W3C validator offline in this manner. If we create an image based off of Debian, we can install into the Docker image the required Perl sources and craft a program that can run in the CLI for offline W3C validation. It would be desirable to write the CLI program that wraps around the Perl source in Go, in order to produce an efficient binary to run inside of the Docker image.

We can then make the resulting program an ALE supported linter, with good default support for executing the validator via Docker. We will thus achieve an effcient offline version of the official W3C validator, which can be used by ALE and all other editors.

@w0rp w0rp added the new tool Support for new linters, fixers, etc. label Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new tool Support for new linters, fixers, etc.
Projects
None yet
Development

No branches or pull requests

1 participant