linter-vnu

Lint HTML5 or XHTML5 on the fly using the Nu Html Checker (v.Nu)

Graham Hannington

2,944

1

0.1.3

MIT

GitHub

This package provides the following services:

The v.Nu linter (linter-vnu)

A linter for the Atom editor that uses the Nu Html Checker (v.Nu) to validate HTML5 or XHTML5 documents as you type ("on the fly") or when you save.

Preview

Don't other Atom linters already do this?

No. The v.Nu linter is the first Atom linter to use v.Nu.

Neither linter-htmllint nor linter-xmllint do what linter-vnu does.

If you want to use xmllint to validate (X)HTML, you might be interested in the unsoup/validator GitHub repo.

Why v.Nu?

How it works

  1. The v.Nu linter uses an Ajax request to send the current Atom document to v.Nu.
  2. v.Nu returns validation messages in JSON format.
  3. The v.Nu linter converts the messages into the JSON required by the Atom Linter.
  4. The Atom Linter displays the messages.

The v.Nu linter is a client of the v.Nu web service and a linter provider for the Atom Linter. The v.Nu linter is just glue code. The real work is done by v.Nu and Linter.

Requirements

The URL might be a localhost URL, referring to an instance of v.Nu installed on your computer.

Reasons to install v.Nu

You do not need to install v.Nu on your computer to use the v.Nu linter. You just need a v.Nu URL.

However, there are reasons to install v.Nu on your computer. For similar reasons, you might choose to install v.Nu on a computer that you share with other users on an intranet.

Performance

The v.Nu linter communicates with v.Nu via HTTP(S). Installing v.Nu on your computer means you can specify a localhost URL for v.Nu, such as http://localhost:8888, bypassing network interface hardware.

You can configure the v.Nu linter to lint either as you type ("on the fly") or only when you save. By default, the v.Nu linter lints on the fly: it sends the current document to v.Nu every 0.3 seconds while you are typing. You can set this interval in the Linter package settings. If you routinely stream high-definition video across your network, this traffic might not be an issue. Otherwise, it's worth considering.

Linter triggers its providers only while you are typing. To see what this means in practice - in terms of frequency of Ajax requests from the v.Nu linter to v.Nu - use the Atom developer tools to monitor network activity.

If you choose not to lint as you type - to lint only when you save - then performance is less of an issue.

Security

A localhost URL means your data stays on your computer.

Courtesy

Is it cool (polite) to post every 0.3 seconds to a public v.Nu that you don't pay for? See the validator.nu terms of service.

Installation

  1. Install the Atom editor.
  2. Install the Atom Linter package.
    For example: in Atom, select File ▶ Settings ▶ Install, and then select linter.
  3. Install this package (linter-vnu).
  4. Decide whether to install v.Nu on your computer or to use an existing v.Nu instance.

To help you decide, see "Reasons..." (above).

To install v.Nu on your computer, continue to the next step. Otherwise, skip to step 10. 5. If you do not have Java on your computer, install it.

v.Nu is a Java application. It requires a Java runtime.

For more details on v.Nu installation requirements, such as the minimum Java version required, see the v.Nu documentation.

To check your Java version, enter java -version at a command prompt. 5. Download the latest v.Nu release vnu.jar_....zip file. 6. Extract the contents of the .zip file. 7. Open a command prompt in the directory containing the extracted vnu.jar file. 8. Enter the following java command to start v.Nu as a standalone web server:

java -Xss512k -cp vnu.jar nu.validator.servlet.Main 8888

For more information on installing v.Nu, see the v.Nu documentation. 9. Confirm that v.Nu is running: open the URL (for example, http://localhost:8888) in a browser. 10. If you are not using the default URL http://localhost:8888, point the v.Nu linter at the correct URL: in Atom, select File ▶ Settings ▶ Packages, select linter-vnu, and then enter the URL.

Usage

To validate the current document as HTML5, give it the file extension .html or one of the other file extensions that belong to the HTML grammar.

To validate the current document as XHTML5 (the XML serialization of HTML5), the document must have the file extension .xhtml.

The examples directory of this package contains files to play with.

To do

Perhaps. Given time. If there's interest from users.

Terminology

"The v.Nu linter" is an abbreviation for "An Atom linter provider for v.Nu, developed by Graham Hannington at Fundi Software".

"v.Nu linter" is, arguably, both a tautology and a lie. v.Nu might be characterized as a linter (cue the punditry on linter versus validator versus document conformance checker 😄), but the v.Nu linter is not v.Nu. And the v.Nu linter is not, by itself, a linter.

The use of a leading definite article - the v.Nu linter - is also questionable. See the disclaimer.

Reporting issues

To report issues with messages from v.Nu, please contact the v.Nu developers.

To report issues with the v.Nu linter, such as how the v.Nu linter presents messages from v.Nu, create an issue for the linter-vnu repo.

Disclaimer

The developer of the v.Nu linter is sincerely grateful to, but is not affiliated with, the developers of v.Nu.

Acknowledgments

Thanks to the developers of v.Nu, Atom, and Atom Linter. Your hard work made developing the v.Nu linter easy.