@accuser/svelte-mdast-directive
v0.3.2
Published
Transforms Markdown source (as a `string`) or a [Markdown AST](https://github.com/syntax-tree/mdast) into Svelte components.
Downloads
86
Maintainers
Readme
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} />