Add support to markdown

This commit is contained in:
Midou 2023-06-09 15:34:35 +01:00
parent 9126593eba
commit fc4cbc0b08
Signed by: midou
GPG Key ID: 1D134A95FE521A7A
3 changed files with 361 additions and 343 deletions

View File

@ -35,6 +35,7 @@
"dependencies": { "dependencies": {
"@auth/core": "^0.2.5", "@auth/core": "^0.2.5",
"@auth/sveltekit": "^0.1.12", "@auth/sveltekit": "^0.1.12",
"joi": "^17.7.0" "joi": "^17.7.0",
"snarkdown": "^2.0.0"
} }
} }

696
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
import Hero from "$lib/Hero.svelte"; import Hero from "$lib/Hero.svelte";
import sanitizeHtml from "sanitize-html"; import sanitizeHtml from "sanitize-html";
import type { PageData } from "./$types"; import type { PageData } from "./$types";
import snarkdown from 'snarkdown';
export let data: PageData; export let data: PageData;
@ -46,12 +47,12 @@
{#if data.announcements.incident.content} {#if data.announcements.incident.content}
<p> <p>
{@html sanitizeHtml( {@html snarkdown(sanitizeHtml(
data.announcements.incident.content.replace( data.announcements.incident.content.replace(
/\n/g, /\n/g,
"<br />" "<br />"
) )
)} ))}
</p> </p>
{/if} {/if}