Skip to content

accuser/svelte-mdast

Repository files navigation

Svelte Unist

Transform Mdast into Svelte components.

Installing

Add the @accuser/svelte-hast package dependency to your Svelte / SvelteKit project:

npm install --save-dev @accuser/svelte-mdast

Usage

<script lang="ts">
	import { Mdast } from '@accuser/Mdast.svelte';
	import { u } from 'unist-builder';

	const ast: import('mdast').Root = u('root', [
		u('heading', { depth: 1 as const }, [u('text', 'Hello, World!')]),
	]);
</script>

<Mdast {ast} />

Test

npm test

License

MIT

Copyright

Copyrigth © 2024 Matthew Gibbons