Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Convert the content in an Editor to a Notion Page #336

Open
shenli opened this issue Mar 8, 2024 · 1 comment
Open

feat: Convert the content in an Editor to a Notion Page #336

shenli opened this issue Mar 8, 2024 · 1 comment
Labels
feature New feature or request

Comments

@shenli
Copy link

shenli commented Mar 8, 2024

Describe the feature you'd like to request

Hello, I would like to create a new page in my Notion according to the content in the editor. May I know what is the best way to do this? Thanks!
https://developers.notion.com/reference/page

Describe the solution you'd like to see

Have a function to convert the data in an editor to a JSON structure which can not used to create a Notion page.

Additional information

    "children": [
        {
            "object": "block",
            "heading_2": {
                "rich_text": [
                    {
                        "text": {
                            "content": "Lacinato kale"
                        }
                    }
                ]
            }
        },
        {
            "object": "block",
            "paragraph": {
                "rich_text": [
                    {
                        "text": {
                            "content": "Lacinato kale is a variety of kale with a long tradition in Italian cuisine, especially that of Tuscany. It is also known as Tuscan kale, Italian kale, dinosaur kale, kale, flat back kale, palm tree kale, or black Tuscan palm.",
                            "link": {
                                "url": "https://en.wikipedia.org/wiki/Lacinato_kale"
                            }
                        },
                        "href": "https://en.wikipedia.org/wiki/Lacinato_kale"
                    }
                ],
                "color": "default"
            }
        }
    ]
@andrewdoro andrewdoro added the feature New feature or request label Mar 8, 2024
@shenli
Copy link
Author

shenli commented Mar 15, 2024

I find a simple way to do this: https://gist.github.com/shenli/57cfd7f211dbd45fc78b1177d9fdf269
Tested with some simple cases, it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants