Linting is the process of running a program that will analyse code for potential errors.
In this article we will be Sublime Text 3, SublimeLinter, SublimeLinter HTML Tidy, and HTML Tidy for Windows to lint some HTML code.
- Install Sublime Text 3
- Install SublimeLinter
- Install HTML Tidy for Windows
- Install SublimeLinter HTML Tidy
Install Sublime Text 3
Sublime Text 3 is a sophisticated text editor for code, markup, and prose.
This is a free software to try and the trial period doesn’t stop but it does have a pop up every so often that reminds to you play fair. Purcase the software like I did. It is a solid investment if you are going to do any coding.
Install SublimeLinter
SublimeLinter is a plugin for Sublime Text that provides a framework for linting code.
- With Sublime Text 3 open hold
CTRL + SHIFT + P
and typeinstall
- Select
Package Control: Install Package
- Type
SublimeLinter
- Select
SublimeLinter
- You will get a Package Control Message that says the package is installed
Install HTML Tidy for Windows
HTML Tidy for Windows is a binary that is needed by the SublimeLinter HTML Tidy plugin. It allows you to run Tidy on Windows.
- Navigate to the HTML Tidy for Windows website
- Select the tidy.zip link to download
- Extract the tidy.exe file to a place that SublimeLinter will have access to it
- For example C:\Users\Username\tidy
Install SublimeLinter HTML Tidy
- With Sublime Text 3 open hold
CTRL + SHIFT + P
and typeinstall
- Select
Package Control: Install Package
- Type
Sublimelinter-html-tidy
- Select
Sublimelinter-html-tidy
- You will get a Package Control Message that says the package is installed
- To use tidy you have to point SublimeLinter to the tidy.exe file
-
In Sublime Text 3 navigate to
Preferences > Package Settings > SublimeLinter > Settings
-
In the new window scroll down to
paths
-
Copy that section to the tab on the right
"paths": { "linux": [], "osx": [], "windows": [] },
-
Enter your path to tidy.exe in the
windows
option{ "paths": { "linux": [], "osx": [], "windows": ["~/tidy"] }, }
Note: You need to use forward slashes.
-
Save the setting with
CTRL + S
-
Close the window
-
- Now open a HTML document and errors in your HTML will be displayed