Skip to content

Conversation

@Shenoudafarouk
Copy link

Added the ability to HTML renderer for the Contentful rich text field type.

you can enable as follows:

const data = await contentfully.getEntries(query,  { renderRichtext: true });

so the old response was look something like this:

{
        "_id": "26sw3opeSNXmhzS9kgpfde",
        "_type": "helloworld",
        "_createdAt": "2022-02-08T15:03:27.611Z",
        "_updatedAt": "2022-02-16T17:07:27.784Z",
        "title": "Hello World",
        "richtext": [
            {
                "nodeType": "paragraph",
                "content": [
                    {
                        "nodeType": "text",
                        "value": "hallo world",
                        "marks": [
                            "italic",
                            "underline"
                        ]
                    }
                ]
            }
        ]
}

after enabling the option It should look something like this:

{
        "_id": "26sw3opeSNXmhzS9kgpfde",
        "_type": "helloworld",
        "_createdAt": "2022-02-08T15:03:27.611Z",
        "_updatedAt": "2022-02-16T17:07:27.784Z",
        "title": "Hello World",
        "richtext": "<p><u><i>hallo world</i></u></p>"
}

@Shenoudafarouk Shenoudafarouk changed the title adding renderRichtext option to render html Feature/adding renderRichtext option Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant