This package is deprecated and archived in favour of the official package that has been released https://github.com/portabletext/svelte-portabletext/
Provides a way to render Portable Text in Svelte applications.
npm add --save-dev @arzidava/svelte-portable-text
<script>
import BlockContent from "@arzidava/svelte-portable-text";
import Image from "./Image";
import Link from "./Link";
export let content;
export const customSerializers = {
types: {
image: props => {
return {
component: Image,
props: {
url: props.node.url,
},
};
},
},
marks: {
link: props => {
return {
component: Link,
props: props.mark,
};
},
},
};
</script>
<BlockContent blocks="{content}" serializers="{customSerializers}" />
This package is under development but should cover the most basic usages. A demo setup of this package using Sanity can be found here.
If you find bugs, just open an issue (or even better a Pull Request) 😀