11# rich-text-vue-renderer
22
3- Vue renderer for the Contentful rich text field type.
3+ Vue 3 renderer for the Contentful rich text field type.
44
5- ## Version 2.x dropped support for Node 8. If you need Node 8 support, remain on 1.x!
5+ ## Version 2.x is for Vue 2 support.
6+
7+ ## Changelog
8+
9+ See releases page for changelog of versions.
610
711## Installation
812
@@ -98,6 +102,7 @@ You can also pass custom renderers for both marks and nodes as an optional param
98102
99103``` html
100104<script >
105+ import { h } from " vue" ;
101106import { BLOCKS , MARKS } from ' @contentful/rich-text-types' ;
102107import RichTextRenderer from ' contentful-rich-text-vue-renderer' ;
103108
@@ -132,12 +137,12 @@ export default {
132137 methods: {
133138 renderMarks () {
134139 return {
135- [MARKS .BOLD ]: (text , key , h ) => h (' custom-bold' , { key : key }, text)
140+ [MARKS .BOLD ]: (text , key ) => h (' custom-bold' , { key }, text)
136141 };
137142 },
138143 renderNodes () {
139144 return {
140- [BLOCKS .PARAGRAPH ]: (node , key , h , next ) => h (' custom-paragraph' , { key: key }, next (node .content , key, h , next))
145+ [BLOCKS .PARAGRAPH ]: (node , key , next ) => h (' custom-paragraph' , { key }, next (node .content , key, next))
141146 }
142147 };
143148 }
@@ -154,6 +159,7 @@ Last, but not least, you can pass a custom rendering component for an embedded e
154159
155160``` html
156161<script >
162+ import { h } from " vue" ;
157163import { BLOCKS } from ' @contentful/rich-text-types' ;
158164import RichTextRenderer from ' contentful-rich-text-vue-renderer' ;
159165
@@ -171,8 +177,8 @@ const document = {
171177
172178// Example function to render an embedded entry in a RichText editor.
173179// For instance, a react-router link to an entry.
174- const customEmbeddedEntry = (node , key , h ) => {
175- return h (' Link' , { key: key , to: ' link to embedded entry' }, ' content for the <Link> component' );
180+ const customEmbeddedEntry = (node , key ) => {
181+ return h (' Link' , { key, to: ' link to embedded entry' }, ' content for the <Link> component' );
176182};
177183
178184export default {
0 commit comments