You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/ISSUE_TEMPLATE/formatting.yml
+2-1
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,8 @@ body:
24
24
description: What value do you have the `xmlWhitespaceSensitivity` option set to? (Defaults to `"strict"`.) Be 100% sure changing this to `"ignore"` doesn't fix your issue!
Copy file name to clipboardExpand all lines: README.md
+4-2
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ Below are the options (from [`src/plugin.js`](src/plugin.js)) that `@prettier/pl
53
53
|`singleAttributePerLine`|`--single-attribute-per-line`|`false`| Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#single-attribute-per-line)) |
54
54
|`tabWidth`|`--tab-width`|`2`| Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#tab-width)). |
55
55
|`xmlSelfClosingSpace`|`--xml-self-closing-space`|`true`| Adds a space before self-closing tags. |
56
-
|`xmlWhitespaceSensitivity`|`--xml-whitespace-sensitivity`|`"strict"`| Options are `"strict"`and `"ignore"`. You may want `"ignore"`, [see below](#whitespace). |
56
+
|`xmlWhitespaceSensitivity`|`--xml-whitespace-sensitivity`|`"strict"`| Options are `"strict"`, `"preserve"`and `"ignore"`. You may want `"preserve"`, [see below](#whitespace). |
57
57
58
58
Any of these can be added to your existing [prettier configuration
59
59
file](https://prettier.io/docs/en/configuration.html). For example:
In XML, by default, all whitespace inside elements has semantic meaning. For prettier to maintain its contract of not changing the semantic meaning of your program, this means the default for `xmlWhitespaceSensitivity` is `"strict"`. When running in this mode, prettier's ability to rearrange your markup is somewhat limited, as it has to maintain the exact amount of whitespace that you input within elements.
76
76
77
-
If you're sure that the XML files that you're formatting do not require whitespace sensitivity, you can use the `"ignore"` option, as this will produce a standardized amount of whitespace. This will fix any indentation issues, and collapse excess blank lines (max of 1 blank line). For most folks most of the time, this is probably the option that you want.
77
+
You can use the `"preserve"` option, if you want to preserve the whitespaces of the text node within XML elements and attributes. (see [Issue #478](https://github.com/prettier/plugin-xml/issues/478)). For most folks most of the time, this is probably the option that you want.
78
+
79
+
If you're sure that the XML files that you're formatting do not require whitespace sensitivity, you can use the `"ignore"` option, as this will produce a standardized amount of whitespace. This will fix any indentation issues, and collapse excess blank lines (max of 1 blank line).
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at est eget enim consectetur accumsan. Aliquam pretium sodales ipsum quis dignissim. Sed id sem vel diam luctus fringilla. Aliquam quis egestas magna. Curabitur molestie lorem et odio porta, et molestie libero laoreet. Morbi rhoncus sagittis cursus. Nullam vehicula pretium consequat. Praesent porta ante at posuere sollicitudin. Nullam commodo tempor arcu, at condimentum neque elementum ut.
0 commit comments