diff --git a/documentation/docs/07-misc/07-v5-migration-guide.md b/documentation/docs/07-misc/07-v5-migration-guide.md index 5a80734b7a..564c707fd2 100644 --- a/documentation/docs/07-misc/07-v5-migration-guide.md +++ b/documentation/docs/07-misc/07-v5-migration-guide.md @@ -682,6 +682,24 @@ Previously, Svelte employed a very complicated algorithm to determine if whitesp - Whitespace between nodes is collapsed to one whitespace - Whitespace at the start and end of a tag is removed completely + + This new behavior is slightly different from native HTML rendering. For example, `

foo - bar

` will render: + + - `foo - bar` in HTML + - `foo- bar` in Svelte 5 + + You can reintroduce the missing space by moving it outside the ``... + + ```svelte +

foo - bar

+ ``` + +...or, if necessary for styling reasons, including it as an expression: + +```svelte +

foo{' '}- bar

+``` + - Certain exceptions apply such as keeping whitespace inside `pre` tags As before, you can disable whitespace trimming by setting the `preserveWhitespace` option in your compiler settings or on a per-component basis in ``.