HTML editor with built in validator?

HTML editor with built in validator?

Author
Discussion

TonyRPH

Original Poster:

13,119 posts

174 months

Thursday 25th August 2022
quotequote all
I'm looking for an HTML editor with built in validation (preferably free!).

Most of the coding I do is in PHP which outputs the HTML, and I use the excellent W3C validator to check pages.

However, sometimes it would be handy to be able to paste the HTML output into an editor to check for missing / misplaced </div> tags and the like.

Firefox used to be able to do this when viewing the HTML source (it would highlight erroneous tags in red) but it doesn't seem to do that any more?

So any suggestions?

Thanks.

selwonk

2,132 posts

231 months

Thursday 25th August 2022
quotequote all
If you install Visual Studio code:

https://code.visualstudio.com/

...you can "lint" your HTML and it will also allow you to install plugins for PHP which will validate your code.

mw88

1,457 posts

117 months

Thursday 25th August 2022
quotequote all
There's probably an extension for VSCode that will do what you want.

Something like: https://marketplace.visualstudio.com/items?itemNam...

maffski

1,880 posts

165 months

Thursday 25th August 2022
quotequote all
Another vote for VS Code. If you link it to the PHP exe it will do some validation without a plugin.

TonyRPH

Original Poster:

13,119 posts

174 months

Thursday 25th August 2022
quotequote all
Thanks for the suggestions. I installed VSCode this afternoon, and installed a plugin (I forget which and I'm not at that PC at the moment) but I couldn't work out how to make it validate the HTML I had pasted in to the editor.

As for PHP plugins - all my dev work is done on a remote Linux box using vi as the editor, hence I just view source in the browser and copy / paste into the W3C validator (when the page is not public).

I have at least solved the issue that was bugging me earlier today, but I'll do a bit of research and find out how to make full use of VSCode.

I have found this SO thread about it which should help!

https://stackoverflow.com/questions/44559598/how-t...

This was the plugin I installed (which looks to be the wrong one!?)

https://marketplace.visualstudio.com/items?itemNam...


eps

6,398 posts

275 months

Tuesday 30th August 2022
quotequote all
Notepad++ is useful for this

selwonk

2,132 posts

231 months

Thursday 1st September 2022
quotequote all
TonyRPH said:
Thanks for the suggestions. I installed VSCode this afternoon, and installed a plugin (I forget which and I'm not at that PC at the moment) but I couldn't work out how to make it validate the HTML I had pasted in to the editor.
Its more that as you write the code, it will validate in the editor as you go. I see your comments re. vi. If you copy/paste the code into Visual Studio and then save it as, for example, test.php, then Visual Studio Code should offer to install some PHP editing plugins automatically. This will validate the code as you type it.

Are you able to FTP to the PHP server? You can use Visual Studio as the registered editor for some FTP clients like Filezilla which would solve your problem. Discussed in this SO article:

https://stackoverflow.com/questions/47530891/how-t...

Essentially:

1. Register VS Code with the FTP client.
2. Connect to the site and list the files.
3. Invoke the edit within the FTP client that will launch VS Code.
4. Edit the file leveraging the linting and other benefits in VS Code.
5. Save the file which will automatically reupload it to the server.

There are other ways. For example, a plug in that automatically does the FTP sync in the background for you:

https://marketplace.visualstudio.com/items?itemNam...

Caveat I've not used that particular plug in so can not endorse it; just an example of what might work.

There are more sophisticated techniques available including over SSH which you might want to explore:

https://code.visualstudio.com/docs/remote/ssh

...but in my experience the FTP FileZilla method would be a good starting point.



TonyRPH

Original Poster:

13,119 posts

174 months

Thursday 1st September 2022
quotequote all
selwonk said:
[Useful stuff]
Thanks for that - I do on occasion use WinSCP as I don't have ftp installed on the server.

I'll take a deeper look into this, as it would make life a bit easier, although I've used vi for that many years I've become somewhat accustomed to it!

@eps - I already use Notepad++ although I've not tried it for HTML / PHP editing.