Skip to content

Commit fdc8aa7

Browse files
authored
Update README.md
1 parent b6bf534 commit fdc8aa7

1 file changed

Lines changed: 102 additions & 3 deletions

File tree

README.md

Lines changed: 102 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ Actually functional HTML Language Server (and Templating Language Library).
44
**NOTE: SuperHTML is still incomplete, some features are missing and looking of somebody to implement them :^)**
55
*And there's also bugs, waiting for people to report them as Issues :^)*
66

7-
![](.github/vscode.png)
8-
97
## HTML Language Server
108
The Super CLI Tool offers syntax checking and autoformatting features for HTML files.
119

@@ -22,11 +20,112 @@ General Options:
2220
--help, -h Print command specific usage
2321
```
2422

25-
### VSCode Support
23+
### Diagnostics
24+
25+
<img src=".github/vscode.png" width="70%">
26+
27+
This language server is stricter than the HTML spec whenever it would prevent potential human errors from being reported.
28+
29+
30+
As an example, HTML allows for closing some tags implicitly. For example the following snipped is correct HTML.
31+
32+
```html
33+
<ul>
34+
<li> One
35+
<li> Two
36+
</ul>
37+
```
38+
39+
This will still be reported as an error by SuperHTML because otherwise the following snippet would have to be considered correct (while it's much probably a typo):
40+
41+
```html
42+
<h1>Title<h1>
43+
```
44+
45+
### Autoformatting
46+
<img src=".github/vscode-autoformat.gif" width="70%">
47+
48+
The autoformatter has two main ways of interacting with it in order to request for horizontal / vertical alignment.
49+
50+
1. Adding / removing whitespace between the **start tag** of an element and its content.
51+
2. Adding / removing whitespace between the **last attribute** of a start tag and the closing `>`.
52+
53+
54+
#### Example of rule #1
55+
Before:
56+
```html
57+
<div> <p>Foo</p></div>
58+
```
59+
60+
After:
61+
```html
62+
<div>
63+
<p>Foo</p>
64+
</div>
65+
```
66+
67+
##### Reverse
68+
69+
Before:
70+
```html
71+
<div><p>Foo</p>
72+
</div>
73+
```
74+
75+
After:
76+
```html
77+
<div><p>Foo</p></div>
78+
```
79+
80+
#### Example of rule #2
81+
Before:
82+
```html
83+
<div foo="bar" style="verylongstring" >
84+
Foo
85+
</div>
86+
```
87+
88+
After:
89+
```html
90+
<div
91+
foo="bar"
92+
style="verylongstring"
93+
>
94+
Foo
95+
</div>
96+
```
97+
98+
##### Reverse
99+
100+
Before:
101+
```html
102+
<div
103+
foo="bar"
104+
style="verylongstring">
105+
Foo
106+
</div>
107+
```
108+
109+
After:
110+
```html
111+
<div foo="bar" style="verylongstring">
112+
Foo
113+
</div>
114+
```
115+
116+
### Editor support
117+
#### VSCode
26118
1. Download a prebuilt version of `super` from the Releases section (or build it yourself).
27119
2. Put `super` in your `PATH`.
28120
3. Install the [Super HTML VSCode extension](https://marketplace.visualstudio.com/items?itemName=LorisCro.super).
29121

122+
#### Flow
123+
Already defaults to using SuperHTML, just add the executable to your `PATH`.
124+
125+
#### Other editors
126+
Follow your editor specific intructions on how to define a new Language Server for a given language / file format.
127+
128+
*(Also feel free to contribute more specific intructions to this readme / add files under the `editors/` subdirectory).*
30129

31130
## Templating Language Library
32131
SuperHTML is not only an LSP but also an HTML templating language. More on that soon.

0 commit comments

Comments
 (0)