Basic Quiztivity working

This commit is contained in:
Mawoka
2023-05-13 19:49:38 +02:00
parent 2750e7539d
commit f23fb4f625
15 changed files with 295 additions and 14 deletions
@@ -0,0 +1,21 @@
<!--
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-->
<script lang="ts">
import type { Markdown } from '$lib/quiztivity/types';
import DOMPurify from 'dompurify';
import { marked } from 'marked';
import { browser } from '$app/environment';
export let data: Markdown | undefined;
let rendered_html = '';
$: rendered_html = browser ? DOMPurify.sanitize(marked.parse(data.markdown ?? '')) : '';
</script>
<div class="prose dark:prose-invert">
{@html rendered_html}
</div>