On comment nodes, the same rules can be applied as on HTML. Otherwise, only its attributes can be formatted, but not its textual contents. If the direct child of uses an xmlns known to prettier, such as XHTML or SVG, it can also be formatted. The tag allows to include elements from a different XML namespace into the SVG document. Since prettier can already interpret CSS, its contents can also be formatted by prettier. ![]() There are some special tags that can be interpreted by prettier in a special way. I fiddled a bit with SVG spacing in Google Chrome and concluded whitespace is entirely ignored, so it’s safe to format SVG following the exact same rules as for JSX. (Please correct me if I’m wrong.)Ī nice list of all known SVG elements can be found on. An SVG document is a document which implements the (or https) namespace. I think SVG is by far the most popular human readable XML format. If it’s unknown how a node is interpreted, prettier should keep the original spacing. Otherwise, Prettier wouldn’t be able to guarantee that everybody in a team gets the same consistent results. This is to make sure that when a project is copied to another computer, Prettier’s behavior stays the same. In this case I think nodes should be formatted by prettier the same way as it formats JSX. Prettier intentionally doesn’t support any kind of global configuration. In many cases whitespace is not interpreted. To detect the meaning of an XML document, prettier should interpret the xmlns attribute of the root element. When this is taken into account, there isn’t really a point in applying prettier on XML documents, unless of course, the meaning of the document is taken into account. I didn’t think about whitespace when I initially created this issue.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |