├── .gitignore ├── .python-version ├── .travis.yml ├── LICENSE ├── README.md ├── linter.py ├── messages.json └── messages └── install.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.8 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.6" 4 | install: 5 | - pip install flake8 6 | script: 7 | - flake8 . --max-line-length=120 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SublimeLinter-html-tidy 2 | ========================= 3 | 4 | [![Build Status](https://travis-ci.org/SublimeLinter/SublimeLinter-html-tidy.svg?branch=master)](https://travis-ci.org/SublimeLinter/SublimeLinter-html-tidy) 5 | 6 | This linter plugin for [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter) provides an interface to tidy (either the [html4](http://tidy.sourceforge.net) or [html5](http://w3c.github.io/tidy-html5/) version). It will be used with files that have the “HTML” syntax. 7 | 8 | ## Installation 9 | SublimeLinter must be installed in order to use this plugin. 10 | 11 | Please install via [Package Control](https://sublime.wbond.net/installation). 12 | 13 | Before installing this plugin, you must ensure that `tidy` or `tidy5` are installed on your system. `tidy5` will be used over `tidy` if available. 14 | 15 | - **Mac OS X** – `tidy` comes preinstalled on recent versions of Mac OS X. You can install the [html5](https://github.com/w3c/tidy-html5) version by using [Homebrew](http://brew.sh) and `brew install tidy-html5`. 16 | 17 | - **Linux** – You should be able to install tidy using the system’s package manager. 18 | 19 | - **Windows** – Windows binaries are available for the [html5](http://tidybatchfiles.info/) version. 20 | 21 | In order for `tidy` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. 22 | 23 | ## Enable for HTML sub syntax 24 | 25 | To enable html-tidy for another syntax edit the SublimeLinter user settings. This example should enable html-tidy for any html sub sytnax. For example, HTML (jinja2), HTML (Rails), HTML (ASP): 26 | 27 | ```json 28 | // SublimeLinter Settings - User 29 | { 30 | "linters": { 31 | "htmltidy": { 32 | "selector": "text.html" 33 | }, 34 | } 35 | } 36 | 37 | 38 | ``` 39 | -------------------------------------------------------------------------------- /linter.py: -------------------------------------------------------------------------------- 1 | from SublimeLinter.lint import Linter, util 2 | 3 | 4 | class HtmlTidy(Linter): 5 | regex = r'^line (?P\d+) column (?P\d+) - (?:(?PError)|(?PWarning)): (?P.+)' 6 | error_stream = util.STREAM_STDERR 7 | defaults = { 8 | 'selector': 'text.html.basic' 9 | } 10 | 11 | def cmd(self): 12 | """Return a tuple with the command line to execute.""" 13 | # Must return either a full path to a binary or an informal name 14 | # of an executable. 15 | executable = self.which('tidy5') or 'tidy' 16 | return [executable, '-errors', '-quiet', '-utf8'] 17 | -------------------------------------------------------------------------------- /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "install": "messages/install.txt" 3 | } 4 | -------------------------------------------------------------------------------- /messages/install.txt: -------------------------------------------------------------------------------- 1 | SublimeLinter-html-tidy 2 | ------------------------------- 3 | This linter plugin for SublimeLinter provides an interface to tidy. 4 | 5 | Please read the installation instructions at: 6 | 7 | https://github.com/SublimeLinter/SublimeLinter-html-tidy 8 | --------------------------------------------------------------------------------