Render line breaks in change lot HTML representation

This commit is contained in:
thiloho
2025-03-23 14:25:15 +01:00
parent f85a7b3023
commit 20bcd84d7e

View File

@@ -141,9 +141,13 @@
<button type="submit">Compute diff</button> <button type="submit">Compute diff</button>
</form> </form>
{#if form?.logId === id && form?.currentDiff} {#if form?.logId === id && form?.currentDiff}
<pre>{@html DOMPurify.sanitize(form.currentDiff, { <pre>{@html DOMPurify.sanitize(
ALLOWED_TAGS: ["ins", "del"] // .replace takes escaped text representations of line breaks and converts them to real line breaks that render correctly in HTML
})}</pre> form.currentDiff.replace(/\\r\\n|\\n|\\r/g, "\n"),
{
ALLOWED_TAGS: ["ins", "del"]
}
)}</pre>
{/if} {/if}
{/if} {/if}