mirror of
https://github.com/BradNut/svelte-library
synced 2025-09-08 17:40:21 +00:00
26 lines
405 B
Svelte
26 lines
405 B
Svelte
<script>
|
|
import marked from 'marked';
|
|
|
|
export let text = '';
|
|
let markdownText = text;
|
|
// Reactive expression
|
|
$: {
|
|
markdownText = marked(text);
|
|
}
|
|
</script>
|
|
|
|
<div class="markdown-container">
|
|
<textarea id="" cols="30" rows="10" bind:value={text} />
|
|
<div>
|
|
{@html markdownText}
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.markdown-container {
|
|
display: flex;
|
|
}
|
|
.markdown-container > * {
|
|
width: 50%;
|
|
}
|
|
</style>
|