1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// HTML whitespace preservation classification (language-level)
//
// Pure functions for determining which HTML elements preserve whitespace.
// These are language-level utilities independent of any specific tool.
//
// The set is Svelte's and prettier-plugin-svelte's (`<pre>`, `<textarea>`), not the HTML
// spec's `white-space: pre` UA rule (../html/source, Rendering ยง"Flow content"), which also
// names `listing`, `plaintext` and `xmp` and gives `textarea` `pre-wrap`.
/// Whether an HTML element preserves the whitespace of its content: `<pre>` and `<textarea>`,
/// whose content is rendered with every space and line break kept, so a formatter must not
/// collapse, trim or re-indent it.
///
/// The set is the one Svelte's compiler and prettier-plugin-svelte treat that way, not the
/// HTML spec's: the spec's user-agent stylesheet also sets `white-space: pre` on the obsolete
/// `<listing>`, `<plaintext>` and `<xmp>`, which neither tool special-cases (they format as
/// ordinary inline elements), so a Svelte-compatible formatter leaves them out too.