SublimeLinter/SublimeLinter-html-tidy

Sublime Linter isn't working with Tidy-HTML5

jasonlav opened this issue · 5 comments

Installed SublimeLinter-html-tidy
Installed tidy-html5 with Homebrew
alias tidy={path_to_tidy5}
tidy index.html passes validation

Index.html contains HTML5 elements aside tag. However, SublimeLinter shows the aside tag as not valid.

alias works only in the shell instance which you enter it in. SublimeLinter creates a sub-process shell to run its commands in. This means that no matter what you alias tidy to (alias tidy="echo", alias tidy="non_existent_command", etc.), the sub-process will not be affected as it does not read in your .{shell_name}rc file (presuming that you have one - if you just entered the command as-is it will cease to be as soon as you shut your Terminal window).

In order to 'alias' tidy5 as tidy, you will need to sym-link tidy to tidy5. To do this, enter the following at a command line:

sudo ln -s $(which tidy5) /usr/local/bin/tidy

This will create a sym-link at /usr/local/bin/tidy pointing to wherever tidy5 is installed (which will find this automatically, presuming that tidy5 is in your path. Because /usr/local/bin/ is in your Path, SublimeLinter will be able to find tidy5.

If you still have problems, I would recommend removing tidy, as it comes pre-installed on most recent Mac OS X systems, due to the order in which the Path is searched for executables. To find where it is located (I know not, as I am not a user of OS X), execute which tidy.

Hopefully this helps; I'm closing this because it is not a bug. I may add something along these lines to the wiki, if you think that this would help others facing similar problems to you.

The symbolic link did not work for me. However, I simply renamed tidy5 to tidy in the usr/local/bin folder and that resolved the issue. I'm sure not the best solution by any means, but it did work.

You can either sym-link it, rename it, delete the tidy executable, or edit line 21 in linter.py to contain tidy5 instead of tidy. As far as I have experienced, sym-linking is the least hackish method. Still, you got it to work, which is the good thing... :squirrel:

#30 should resolve any issues which you might have with tidy5 order of precedence.

drgeb commented

sudo ln -s /usr/local/bin/tidy /usr/local/bin/tidy5