svelte-hast Svelte Themes

Svelte Hast

Svelte Hast

Transform Hast into Svelte components.

Installing

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

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

Usage

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

    const ast: import('hast').Root = u('root', [
        u('element', { tagName: 'h1', properties: {} }, [u('text', 'Hello, World!')])
    ]);
</script>

<Hast {ast} />

Test

npm test

License

MIT

Copyrigth © 2024 Matthew Gibbons

Top categories

Loading Svelte Themes