Hi,
Used the Validation plugin “W3C Validators” for years, but it recently stopped working on Windows and Mac. Does anyone know of a alternative to do HTML validation within Sublime text 4?
Regards,
David
Hi,
Used the Validation plugin “W3C Validators” for years, but it recently stopped working on Windows and Mac. Does anyone know of a alternative to do HTML validation within Sublime text 4?
Regards,
David
Looking at the package, looks like it’s not seen any activity since 2017. So not sure why would it break suddenly if it was working earlier. You haven’t mentioned if there are any errors in the console or what exactly is not working ? If you could post that, maybe someone can help.
Yes I have seen errors in the console talking about a not valid certificate or something with the SSL.
Maybe the URL of W3V has changed?
File "C:\Users\David\AppData\Roaming\Sublime Text 3\Installed Packages\W3CValidators.sublime-
package\W3CValidators.py", line 64, in run
File "C:\Users\David\AppData\Roaming\SUBLIM~1\Packages\requests\all\requests\api.py", line 112,
in
post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Users\David\AppData\Roaming\SUBLIM~1\Packages\requests\all\requests\api.py", line 58,
in
request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\David\AppData\Roaming\SUBLIM~1\Packages\requests\all\requests\sessions.py",
line
522, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\David\AppData\Roaming\SUBLIM~1\Packages\requests\all\requests\sessions.py",
line 642, in send
r = adapter.send(request, **kwargs)
File "C:\Users\David\AppData\Roaming\SUBLIM~1\Packages\requests\all\requests\adapters.py",
line 513, in send
raise SSLError(e, request=request)
(_ssl.c:548)
raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate
verify failed (_ssl.c:548)
I guess this may be caused by an expired root certificate, which is used with priority by python 3.3’s urllib.
See:
@deathaxe
Thanks for the link!
Unfortunately that means that there is no HTML validation available anymore in Sublime Text?
Or is there a alternative that I don’t know of?
What kind of HTML validation ? I wonder if LSP + LSP-html can do it, but probably @rwols may have a better idea about it.
W3C Markup Validation Service from within Sublime Text, meaning you can test local in Sublime and a local server with no need to be online on my live server with the website or app I’m working on. Worked perfect for years!
You might be able to work around the ssl issue by adding a .python-version
file containing 3.8
to that plugin. Otherwise you could use the command line tools with a custom build system to do the validation locally instead of uploading your code every time you want to check it (see http://validator.w3.org/source/#getting).
Thanks for the tip!
Can you please explain how to get (on Mac) python 3.8 locally installed in a folder of choice?
How do I open the plugin file for further editing of the link to the python 3.8?
Regards,
David
We’ve got documentation on that here: https://www.sublimetext.com/docs/api_environments.html
How do I open the plugin file for further editing of the link to the python 3.8?
Hi,
How can I edit the W3Cvalidators.py file? When I try to change something it doesn’t work! To start with I want to change the URL’s http
in https
class AbstractValidator(sublime_plugin.TextCommand):
markup_validator_url = 'http://validator.w3.org/check'
css_validator_url = 'http://jigsaw.w3.org/css-validator/validator'
What you could try is git cloning https://github.com/ericsorenson/Sublime-W3CValidators into the Packages
directory. And then add a .python-version
file into it containing a single value 3.8
(This will cause the plugin to run in the 3.8 environment). Maybe that can get past the SSL issue your seeing (based on Ben’s message).
If you have used View Package File
, then it won’t work i.e. you can’t edit because it opens package resource files in a read only state.
Anyways the plugin seems simple enough but needs cleaning. Might make a good weekend project.
PY3 = sys.version_info[0] == 3
if PY3:
from urllib.request import urlopen
from urllib.parse import urlencode
else:
from urllib import urlopen
from urllib import urlencode
Is this the part that links to python? And what needs to change?
All of the code in that .py
file is python code and not just the snippet you posted. The suggestion was to create that python version file (and have that value 3.8 in it). That causes the plugin to run using Python 3.8 which is much newer version and might overcome that SSL error. If there are still errors in the console after that, then someone needs to dig deeper into the code to see what’s wrong.