Skip to content

accuser/svelte-mdast-directive

Repository files navigation

Svelte Markdown Provider

Transforms Markdown source (as a string) or a Markdown AST into Svelte components.

Note

You probably don't want this - look at mdsvex or svelte-markdown instead.

Installing

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

npm install --save-dev @accuser/svelte-markdown-provider

Usage

Markdown string

<script>
    import { Markdown } from '@accuser/svelte-markdown-provider';

    const source = 'Hello, World!';
</script>

<Markdown {src} />

Markdown AST

<script>
    import { Markdown } from '@accuser/svelte-markdown-provider';

    const ast = {
        type: 'root',
        children: [{
           type: 'paragraph',
           children: [{
                type: 'text',
                value: 'Hello, World!'
            }]
        }]
    };
</script>

<Markdown {ast} />

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published