Skip to content

Svelte disrespects line break entities, regardless of preserveWhitespace optionΒ #15555

@brunnerh

Description

@brunnerh

Describe the bug

Line feed entities (
) are turned into spaces.

Reproduction

<script>
	import Component from './Component.svelte';
</script>

<!-- Has no line breaks -->
<span title="A&#x0A;B">in title</span>
<Component text="A&#x0A;B" />

<!-- Has line break -->
<Component text={'A\nB'} />
<!-- Component.svelte -->
<script>
	const { text } = $props();
	console.log(JSON.stringify(text));
</script>
<pre>{text}</pre>

Playground

Logs

System Info

REPL

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions