Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Temporary "block content to vue"
<template>
<div v-html="renderHtml(content)"></div>
</template>
<script>
const blocksToHtml = require("@sanity/block-content-to-html")
const h = blocksToHtml.h
const serializers = {
types: {
code: props =>
h("pre", { className: props.node.language }, h("code", props.node.code))
}
}
export default {
name: "BlockToHtml",
props: ["content"],
methods: {
renderHtml(item) {
return blocksToHtml({
blocks: item,
serializers: serializers
})
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.