svelte-exmarkdown

Plugin showcase (Math formula)

If you want to render math formula, you can use remark-math and rehype-katex plugins. Offcourse, you can use rehype-mathjax instead of rehype-katex.

<script lang="ts">
	import type { Plugin } from 'svelte-exmarkdown';
	import Markdown from 'svelte-exmarkdown';
	import 'katex/dist/katex.min.css';
	import rehypeKatex from 'rehype-katex';
	import remarkMath from 'remark-math';

	let md = '$$\n\\int_0^\\infty x^2 dx\n$$';
	const plugins: Plugin[] = [
		{ remarkPlugin: [remarkMath], rehypePlugin: [rehypeKatex] }
	];
</script>

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

0x2dx\int_0^\infty x^2 dx