svelte-exmarkdown

Plugin showcase (Raw HTML)

If you trust the input and you want to use raw HTML, you can use the rehype-raw plugin.

The CommonMark specification allows raw HTML by default, but this library doesn't allow raw HTML by default. This is because raw HTML has potential security issues.

<script lang="ts">
	import type { Plugin } from 'svelte-exmarkdown';
	import Markdown from 'svelte-exmarkdown';
	import rehypeRaw from 'rehype-raw';

	let md = "<div style='color: red;'>Hello, world!</div>";
	const plugins: Plugin[] = [{ rehypePlugin: [rehypeRaw] }];
</script>

<textarea bind:value={md}></textarea>
<Markdown {md} {plugins} />