52 points · by rc00 · 2y ago · 38 comments
Wholeheartedly agree. Can we also go to XHTML5, while on it?
<script src="util.js" />
instead of: <script src="util.js"></script>
would be nice. But it's not (iirc) compatible with WHATWG's HTML5 parsing algorithm, browsers only use XML mode if served the correct content type, and in XML mode they don't recover at all from errors (when really, they should show an annoying popup and then switch to a quirks parser).We need to fix that, before XHTML can be viable. As-is, it's like it's being sabotaged.
This is a recurring argument I see against XHTML. Fundamentally I don’t see it as a downside (you don’t expect the browser to run malformed JavaScript – why not HTML, too?). I agree there’s a couple of possible obstacles, though:
1. It can be hard to produce 100% valid XHTML by hand – I personally run into errors from time to time. This is actually something an LSP could help with! All these errors can be detected at authoring time, given the proper tooling.
2. Naive template systems might produce invalid XHTML if you’re not careful. Personally I haven’t run into such situations, but some people say they do.
This is also a tooling problem, but it’s a bit trickier to tackle. A solution could be either (1) an LSP for the templating system, working together with the (X)HTML LSP, or (2) a templating system that is XML-native (but more ergonomic than XSLT haha).
(Personally, I’m thinking about starting something like (2) with Jinja-like syntax, but I feel it’s not something I have the time or energy for, at this point.)
> when really, they should show an annoying popup and then switch to a quirks parser
Not sure if it’s a good solution long-term, but I see how that could help with adoption, so I’m all for it.
Refer to https://tc39.es/ecma262/2024/multipage/ecmascript-language-l... (extract below)
---
In contrast, the source
{ 1
2 } 3
is also not a valid ECMAScript sentence, but is transformed by automatic semicolon insertion into the following: { 1
;2 ;} 3;
which is a valid ECMAScript sentence.Interviewee: "I see how that could help with adoption, at least until we are able to migrate to a red single-line error with a long-ass-scrollbar that displays instead of rendering any of the page at all."
Interviewer: "Thanks. We'll be in touch."
Personally, I would like that, but in practice I don't think it's ever going to be a thing, so I didn't even bother adding support for it in SuperHTML, sorry!
Would you perhaps be open to a PR, maybe? (I would love to work on something like that, although I’m swamped right now and can’t promise anything.)
But I have no desire to go back.
The Static Site Paradox
It doesn't support implicitly closing <li>, <p>, <dd>, <dt>, <head>, <body> tags which is one of the best features of HTML if you're handwriting it. I assume it doesn't support implicitly opening <html>, <head>, and <body> either. Why do I have to skip indenting those levels when I can simply not open the tags?
HTML is a terrible language and I'd rather write some strict superset of it that includes template tags to make it functional. If HTML features are treated as errors, that's not a superset.
In HTML, <li>item<li> is correct (it gets parsed as <li>item</li><li></li> I think). In SuperHTML it throws an error. Essentially, this is an opinionated subset of HTML, and no one cared enough before.
The common trap many run into is that `<div/>` essentially closes at the next boundary.
Where's the Makefile LSP server? (Ok technically there is one but it barely does anything.)
It’s because it’s not a syntax error, but a legal construct. SuperHTML disallows things HTML allows.
Plus, there's things like browser support, relative paths, and content embedding to consider, which always made dedicated products like Adobe's (Macromedia's?) DreamWeaver hit-or-miss (on top of being a very clunky way to edit some tiny text files).
As for why it took so long...well nobody cared enough, and everyone "just used scripts" i.e. Django, Wordpress, Ruby on Rails, etc, to get that "good enough" experience + access to testing. There's no reason this couldn't have been done back in 2014 when LSPs were first just starting to come into being...
the following snippet is correct HTML [...]
will still be reported as an error by
SuperHTML [...] it's most probably a typo
Bad. A tool should do one thing and do it will. A tool
to verify HTML should verify HTML. Not report errors
where there are none.