{tidy} renders its content first - fields and tags inside resolve as usual - and then passes the result through PHP's tidy extension as a fragment: unclosed elements are closed, the markup is repaired and indented by the settings of $padTidyConfig. Only the body of the fragment comes back, never a <html> around it.

The content of a <textarea>, of a <template> and of a custom element is held out of the pass and put back unchanged, so a form value keeps its whitespace and a component's markup is not rewritten.

Without the tidy extension the content is returned untouched - the result depends on the server, which is why the example is shown rather than run. The tidy option does the same for any tag ({items tidy}...{/items}), and $padTidy in the configuration tidies whole pages. To only take out whitespace between tags, use {spaceless}, which needs no extension.