Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update xml.format.joinContentLines settings documentation #817

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions docs/Formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ Set to `true` to normalize the whitespace of content inside an element. Newlines

When `xml.format.joinContentLines` is set to `false`, the following edits will be made:

* text following a line separator will be appropriately indented
* text following a line separator will be appropriately indented (not applied to cases where the element is categorized as `mixed content`)
* Please see [xml.format.experimental](#xmlformatexperimental) for more information on mixed content
* spaces between text in the same line will be normalized
* any exisiting new lines will be treated with respect to the [`xml.format.preservedNewlines`](#xmlformatpreservednewlines) setting

Expand All @@ -318,29 +319,25 @@ For example, before formatting:
```xml
<?xml version='1.0' encoding='UTF-8'?>
<root>
Interesting text content
<a>
Interesting

<a>
test

</a> values and 1234 numbers
text content
</a> values and

</root>
1234 numbers </root>
```

After formatting with `xml.format.joinContentLines` is set to `false` and `xml.format.preservedNewlines` set to `2`:

```xml
<?xml version='1.0' encoding='UTF-8'?>
<root>
Interesting text content

<a>
test
Interesting

</a> values and 1234 numbers

</root>
text content
</a> values and 1234 numbers </root>
```

To remove all empty new lines, set `xml.format.preservedNewlines` to `0` for the following result:
Expand All @@ -350,18 +347,18 @@ After formatting with `xml.format.joinContentLines` is set to `false` and `xml.f
```xml
<?xml version='1.0' encoding='UTF-8'?>
<root>
Interesting text content
<a>
test
</a> values and 1234 numbers
</root>
Interesting
text content
</a> values and 1234 numbers </root>
```

If `xml.format.joinContentLines` is set to `true`, the above document becomes:

```xml
<?xml version='1.0' encoding='UTF-8'?>
<root> Interesting text content <a> test </a> values and 1234 numbers </root>
<root>
<a> Interesting text content </a> values and 1234 numbers </root>
```

* line breaks will be inserted where needed with respect to the [`xml.format.maxLineWidth`](#xmlformatmaxlinewidth) setting
Expand Down