kerwanp / notion-render

A Javascript library to transform Notion API RichText object into HTML

Home Page:https://notion-render-docs.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Just render rich text

MickL opened this issue · comments

Hello,

I would like to render richtext fields of a page, e.g. I just want to render the "tester":

{
  "object": "page",
  // ...
  "properties": {
    // ...
    "tester": {
      "id": "...",
      "type": "rich_text",
      "rich_text": [
        {
          "type": "text",
          "text": {
            "content": "Hello\n",
            "link": null
          },
          "annotations": {
            "bold": false,
            "italic": false,
            "strikethrough": false,
            "underline": false,
            "code": false,
            "color": "default"
          },
          "plain_text": "Hello\n",
          "href": null
        },
        {
          "type": "text",
          "text": {
            "content": "World",
            "link": null
          },
          "annotations": {
            "bold": true,
            "italic": false,
            "strikethrough": false,
            "underline": false,
            "code": false,
            "color": "default"
          },
          "plain_text": "World",
          "href": null
        }
      ]
    },
  }
}

Should result into:

Hello<br><strong>World</strong>

Is this possible with this library?

Hey! It should already be the case

I dont know how. I ended up checking your source code at Github and just copying this function.