HTMLLint

Lint Instructions

HTML Lint is a tool that makes sure your code looks good. While XHTML was very strict with syntax HTML 5 is more lenient like previous versions of HTML, which means keeping consistent code styles will become more difficult. Validating is not good enough anymore.

HTML Lint is under constant development. If you find a bug, report it on Twitter.

The Options

As code styles differ HTML Lint allows you to set what you want it to check for.

Never Omit Closing Tags

Some HTML elements may have their closing tag omitted. You can find all of them in the specification, but the most common are <li>, <tr>, <td>, <th>.

With this option turned on, you must provide a closing tag for all these elements.

Lowercase Tags

You can write tags in any case you want. Use this option if you want to require all tags to be lowercase (as they must be in XHTML).

Close Empty Elements

HTML void elements must not have a closing tag. All such elements are listed in the specification, but the most common are <br>, <hr>, <img>, <link>, <meta>, <input>, <param>.

Empty elements must be closed in XHTML by using the empty-element tag form (<tag />). With this option turned on, Lint will require all empty tags to be closed.

Quote Attributes

HTML allows unquoted attribute-value syntax where the value of the attribute is not quoted. Use this option to require use of quotes around attribute values (a pair of single or double quotes) as required by XHTML.

Lowercase Attributes

As with tags, you can write attribute names in any case you want. Use this option if you want to require all tags to be lowercase (as they must be in XHTML).

Simple Booleans

HTML allows empty attribute syntax where a boolean attribute is set by only adding its name and no value (in fact any value will set it to True). Use this option to conform to XHTML that does not allow this form and suggests a name="name" syntax.

Equal Indentation

Turning this option on will require you to open and close an element with tags indented equally. This makes reading code and finding mistakes easier even without validation.

Lint API

You can also use our API to get results back from HTML Lint. Current limit is 20 requests every 3 minutes.

The spec for the API below tells you which parameters you need to send to Lint to get it to work.

API endpoint: http://lint.brihten.com/html/lint/

Lint types

The content you need Linted must be smaller than 1MB. Contact us if that is not enough.

Lint options

All these are booleans for the Lint options. Set them to false by sending False, false, 0 or an empty value. Anything else is true.

tags_closeoptional (default: true)
Check the Never Omit Closing Tags section.
tags_lowercase (default: true)
Check the Lowercase Tags section.
tags_closeempty (default: true)
Check the Close Empty Elements section.
attrs_quoted (default: true)
Check the Quote Attributes section.
attrs_lowercase (default: true)
Check the Lowercase Attributes section.
attrs_simplebooleans (default: true)
Check the Simple Booleans section.
tags_whitespace (default: false)
Check the Equal Indentation section.

Output format

Currently the only possible values are "json" and "xml".

response_format (default: json)
The format of the return.

Example

http://lint.brihten.com/html/lint/?url=http%3A%2F%2Fmmm.si%2F&tags_whitespace=true

Try example

Known Lint issues

Lint will not report on anything that should be reported by the validator. It will however stop parsing when it reaches illegally closed tags, as it then cannot know what you wanted to do.

If you think that something is not reported by Lint but should be, contact us.

If you think that something is reported by Lint but shouldn't be, contact us.

  1. Quoted attribute values

    Lint will behave weirdly when it encounters a < or > inside the attributes of an element. The spec says that attribute values are in general "Normal character data", which means that all characters except "<" are allowed (and in case of quoted attributes also the quote used to quote the value - single or double).

    Lint discourages the use of < or > inside attribute values - you should use the corresponding character references.

  2. Unquoted attribute values

    When using unquoted attribute values there must be at least one whitespace character between the value and the / character if the tag is an empty-element tag. This is not yet reported by Lint.

    Another issue is the characters in the unquoted value - the spec says that the value must not containt certain characters (", ', >, =) but this is not enforced yet.

  3. Whitespace in attribute definition

    According to the spec the attributes are defined as [name][WHITESPACE]=[WHITESPACE][value] (in case of quoted attribute values there must be a single ' or " character around the value).

    The [WHITESPACE] is not allowed by Lint.

Lint source

Lint is written in Python and the webapp is based on Django. The code for both will be available on github soon.

Lint people

HTML Lint is a project of MMM. Code written mostly by Marko Mrdjenovič, python help and Django app by Marko Samastur, design by Sara Tušar.