asnunes / notion-page-to-html

NodeJS tool to convert public Notion pages to HTML from page ID
MIT License
161 stars 42 forks source link

Outputs the contents of nested pages too #19

Closed therohitdas closed 2 years ago

therohitdas commented 2 years ago

When you try to get the content of a page, it also adds the HTML content of any nested page.

Take this page as an example- https://therohitdas.notion.site/Rohit-Das-99163302a0c44cd086292fd8f7637c5e I have added a page "Testing something don't mind" page at the very bottom.

The output - https://notion-page-to-html-api.vercel.app/html?id=99163302a0c44cd086292fd8f7637c5e When you visit this link, you can see the content of the nested page at the very bottom.

What would be nice?

FYI - I also hosted the API on Vercel and this is my endpoint: https://notion-page-to-html-api.vercel.app Don't use it for testing. as it points to a fork of this repo.

anamba commented 2 years ago

Turns out this is all that's necessary: https://github.com/anamba/notion-page-to-html/commit/a97e34f914897214d0fae8962a6eb557498ac848

I'm sure there's a better way, but after studying the code for 10 mins this is what I came up with. Just thought I'd share in case it helps someone else.

therohitdas commented 2 years ago

Thank you @anamba It will help me a lot! Forking your repo!

asnunes commented 2 years ago

Hi, @therohitdas. This lib is projected to be a self-contained conversion tool, so you can use it to convert a page to HTML to store in a blog or something like that without any external link that would depend on an external API that could be a bottleneck. I do not pretend to introduce these dependencies for notion-page-to-html as it is not the proposal of the lib, but any fork with new proposals like you and @anamba did are welcome as it creates new possibilities for other use-cases. Closing this issue by now, thank you!