@@ -30,45 +30,45 @@ To render embedded items on the front-end, use the renderOptions function, and d
3030const renderOption = {
3131 // to render Supercharged RTE NodeType content like paragraph, link, table, order list, un-order list and more.
3232 p : (node , next ) => {
33- ` <p class='class-id'>${ next (node .children )} </p>` // you will need to call next function with node children contents
34- }
33+ return ` <p class='class-id'>${ next (node .children )} </p>` // you will need to call next function with node children contents
34+ },
3535 h1 : (node , next ) => {
36- ` <h1 class='class-id'>${ next (node .children )} </h1>` // you will need to call next function with node children contents
37- }
36+ return ` <h1 class='class-id'>${ next (node .children )} </h1>` // you will need to call next function with node children contents
37+ },
3838 // to render Supercharged RTE MarkType content like bold, italic, underline, strikethrough, inlineCode, subscript, and superscript
3939 bold : (text ) => {
40- ` <b>${ next (node .children )} </b>`
41- }
40+ return ` <b>${ next (node .children )} </b>`
41+ },
4242 // to render block-type embedded items
4343 block: {
4444 ' product ' : (item , metadata ) => {
45- ` <div>
46- <h2 >${ item .title } </h2>
47- <img src=${ item .product_image .url } alt=${ item .product_image .title } />
48- <p>${ item .price } </p>
49- </div>`
45+ return ` <div>
46+ <h2 >${ item .title } </h2>
47+ <img src=${ item .product_image .url } alt=${ item .product_image .title } />
48+ <p>${ item .price } </p>
49+ </div>`
5050 },
5151 // to render the default
5252 ' $default ' : (item , metadata ) => {
53- ` <div>
54- <h2>${ item .title } </h2>
55- <p>${ item .description } </p>
56- </div>`
53+ return ` <div>
54+ <h2>${ item .title } </h2>
55+ <p>${ item .description } </p>
56+ </div>`
5757 }
5858 },
5959 // to display inline embedded items
6060 inline: {
6161 ' $default ' : (item , metadata ) => {
62- ` <span><b>${ item .title } </b> - ${ item .description } </span>`
62+ return ` <span><b>${ item .title } </b> - ${ item .description } </span>`
6363 }
6464 },
6565 // to display embedded items inserted via link
6666 link : (item , metadata ) => {
67- ` <a href="${ metadata .attributes .href } ">${ metadata .text } </a>`
67+ return ` <a href="${ metadata .attributes .href } ">${ metadata .text } </a>`
6868 },
6969 // to display assets
7070 display : (item , metadata ) => {
71- ` <img src=${ metadata .attributes .src } alt=${ metadata .alt } />`
71+ return ` <img src=${ metadata .attributes .src } alt=${ metadata .alt } />`
7272 }
7373}
7474```
@@ -104,7 +104,7 @@ Contentstack.Utils.render({ entry, path: ["rte_fieldUid", "group.rteFieldUID"],
104104```
105105
106106#### Render Supercharged RTE contents
107- To get a single entry, you need to provide the stack API key, environment name, delivery token, content type and entry UID. Then, use ` Contentstack.Utils.jsonToHtml ` function as shown below:
107+ To get a single entry, you need to provide the stack API key, environment name, delivery token, content type and entry UID. Then, use ` Contentstack.Utils.jsonToHTML ` function as shown below:
108108``` js
109109import * as Contentstack from ' contentstack'
110110const stack = Contentstack .Stack ({
@@ -117,7 +117,7 @@ stack.ContentType('<CONTENT_TYPE_UID>')
117117 .toJSON ()
118118 .fetch ()
119119 .then (entry => {
120- Contentstack .Utils .jsonToHtml ({
120+ Contentstack .Utils .jsonToHTML ({
121121 entry,
122122 path: [" rte_fieldUid" , " group.rteFieldUID" ],
123123 renderOption
@@ -155,7 +155,7 @@ stack.ContentType('<CONTENT_TYPE_UID>')
155155```
156156
157157#### Render Supercharged RTE contents
158- To get a multiple entries, you need to provide the stack API key, environment name, delivery token, content type and entry UID. Then, use ` Contentstack.Utils.jsonToHtml ` function as shown below:
158+ To get a multiple entries, you need to provide the stack API key, environment name, delivery token, content type and entry UID. Then, use ` Contentstack.Utils.jsonToHTML ` function as shown below:
159159``` js
160160import * as Contentstack from ' contentstack'
161161const stack = Contentstack .Stack ({
@@ -170,7 +170,7 @@ stack.ContentType('<CONTENT_TYPE_UID>')
170170 .find ()
171171 .then (result => {
172172 result .forEach (entry => {
173- Contentstack .Utils .jsonToHtml ({
173+ Contentstack .Utils .jsonToHTML ({
174174 entry,
175175 path: [" rte_fieldUid" , " group.rteFieldUID" ],
176176 renderOption
0 commit comments