The 2024 Wheel Reinvention Jam is in 16 days. September 23-29, 2024. More info
You might not believe it but there is no language server for HTML out there that tells you when you wrote wrong HTML.

About SuperHTML - An HTML Language Server


Open VSCode, or Vim, or your favorite editor and type </span> (closing a tag that you never opened).

Unless your favorite editor happens to be JetBrains WebStorm, you will not see any message that tells you that you wrote wrong HTML.

And keep in mind: WebStorm uses a private implementation for reporting HTML errors that you can't get on other editors and while LSP sucks as a protocol, better to have a syntax checker that also supports it than nothing.

Somehow, in 2024 I ended up writing the first ever language server that reports diagnostics when you write wrong HTML. Note that this is not the first HTML language server ever because technically VSCode has one (that is also used by other editors in "extracted" form), but it just implements a super-simplistic XML-ish parser that even gives you misleading indentation sometimes.

It's not something that shows you the deep inner workings of a subsytem that is otherwise difficult to access, but if you can't see that you wrote wrong HTML, you will keep writing wrong HTML.

Did you know that self-closing tags are an error in HTML5 (eg <br/>)?

With SuperHTML you will learn that, I promise.

Without in-editor support for syntax checking, you are forced to check the correctness of your work by looking at how it renders in a browser, too bad that browsers have recovery strategies explicitly designed to error-correct for wrong HTML.

For example browsers will make sense of <b><i></b></i> and so if you don't notice looking at the source that you mixed your tags, you will never know because the browser is designed to let this slide.

Wanna know who will not let this slide? That's right, SuperHTML.

Lastly, I believe that people will sometimes opt for using JS frameworks that use JSX (html-like syntax embedded in JavaScript files) because they will get a better developer experience that way, even if they don't need any frontend runtime feature.

Hopefully we'll have slightly more correct HTML and fewer unnecessary JS scripts floating around if people can get a good experience writing plain HTML.

You can get a prebuilt version of SuperHTML from the Releases section on GitHub or build it youself with Zig 0.13.0, enjoy!

https://github.com/kristoff-it/superhtml

Read more
Filters

Recent Activity

SuperHTML showing errors when you write bad HTML. &superhtml

View original message on Discord