|
1 | 1 | # SuperHTML |
2 | | -HTML Language Server and Templating Language Library |
| 2 | +HTML Linter, Formatter, LSP, and Templating Language Library |
3 | 3 |
|
4 | | - |
5 | | -## HTML Language Server |
| 4 | +## SuperHTML CLI Tool |
6 | 5 | The SuperHTML CLI Tool offers **validation** and **autoformatting** features for HTML files. |
7 | 6 |
|
8 | 7 | The tool can be used either directly (for example by running it on save), or through a LSP client implementation. |
@@ -174,6 +173,39 @@ Follow your editor specific instructions on how to define a new Language Server |
174 | 173 |
|
175 | 174 | *(Also feel free to contribute more specific instructions to this readme / add files under the `editors/` subdirectory).* |
176 | 175 |
|
| 176 | + |
| 177 | +## FAQs |
| 178 | +### Why doesn't SuperHTML support self-closing tags? |
| 179 | +Because self-closing tags don't exist in HTML and, while harmless when used with void elements, it just keeps misleating people into thinking that you can self-close HTML tags. |
| 180 | + |
| 181 | +In particular, given this HTML code: |
| 182 | + |
| 183 | +```html |
| 184 | +<!doctype html> |
| 185 | +<html> |
| 186 | + <head></head> |
| 187 | + <body> |
| 188 | + <div/> |
| 189 | + <p></p> |
| 190 | + </body> |
| 191 | +</html> |
| 192 | +``` |
| 193 | + |
| 194 | +You might think that `<div>` and `<p>` are siblings, while in reality browsers are required **by the spec** to ignore the self-closing slash in `<div/>`, making `<p>` a child, not a sibling of it. |
| 195 | + |
| 196 | +Add to that the fact that tooling like the default HTML formatter in VSCode will provide misleading autoformatting (try it yourself, disable SuperHTML in VSCode and autoformat the snippet above), to this day people are way more confused about HTML than they need to be. |
| 197 | + |
| 198 | +Related: [#100](https://github.com/kristoff-it/superhtml/pull/100). |
| 199 | + |
| 200 | +### Why doesn't SuperHTML report duplicate values in `[class]` as an error? |
| 201 | +The HTML spec defines the global `class` attribute as a space-separated list of tokens, as opposed to a space-separated list of *unique* tokens, like some other attributes are (e.g. `accesskey`). |
| 202 | + |
| 203 | +### Why is `<style>` under `<body>` an error? It works in all browsers! |
| 204 | +As far as I'm concerned, there is no good reason to forbid `<style>` in body, but that's what the HTML spec does. |
| 205 | + |
| 206 | +Related upstream issue: https://github.com/whatwg/html/issues/1605 |
| 207 | + |
| 208 | + |
177 | 209 | ## Templating Language Library |
178 | 210 | SuperHTML is also a HTML templating language. More on that soon. |
179 | 211 |
|
|
0 commit comments