souvikinator / notion-to-md

Convert notion pages, block and list of blocks to markdown (supports nesting and custom parsing)
https://www.npmjs.com/package/notion-to-md
MIT License
1.11k stars 91 forks source link

Does this recursively render nested pages? #58

Closed t3db0t closed 1 year ago

t3db0t commented 1 year ago

I have a book written in Notion where each chapter is its own Page, all collected in one master Page. Does this library recursively render those child pages (and any child pages they may have) into one single concatenated Markdown string?

Thanks!

souvikinator commented 1 year ago

No it does not. Link to those pages are converted into markdown links.

t3db0t commented 1 year ago

Thanks for the reply!

abudhakeer commented 1 year ago

Hey, to validate the same use case i tried with a very small page which has nested pages and I got desired output.

[Page 1](67795d5b-7733-452a-83dc-025724b930bf)

        This is the content of the page 1

        [Page 1.1](13860609-1fa5-417a-9be2-729fb83706bf)

                This is the content of Page 1.1

But when I tried with a pretty big book I am just getting the appropriate page ids and not the whole content. IN both the cases I used pageToMarkdown with just the page id and when I tried with a total page number like 100 am still getting the same. @souvikinator Any help?

abudhakeer commented 1 year ago

Okay, i figured that in the case which it didn't work as expected the pages are inside the 'column_list' type. So is there any inbuilt support to get the same as similar to above example I shared should i need to handle it by myself?

souvikinator commented 1 year ago

Can you provide steps to reproduce the issue? @abudhakeer or maybe share the notion page link with similar format?

abudhakeer commented 1 year ago

Sure. Here it is https://www.notion.so/Blendle-s-Employee-Handbook-7692ffe24f07450785f093b94bbe1a09

abudhakeer commented 1 year ago

@souvikinator Were you able to check it out?

lukasvarkalis commented 1 year ago

@abudhakeer Thanks for creating this issue. I am also looking forward to learning how to fetch all inner pages as well.

abudhakeer commented 1 year ago

@souvikinator Any update ser?

souvikinator commented 1 year ago

Hey, my bad I got occupied with stuff. I checked out the page and as you said, there is an inconsistency in parsing. In the column, the page content is not being fetched however that is not the case when the pages are listed typically.

Also, the content of the page is not being rendered properly.

I would like to know how you want this to be parsed. Do you want the content of the nested pages on the same page or only link to the nested pages?

abudhakeer commented 1 year ago

Thank you for the response. Would be better if it's something similar to this example shared here https://github.com/souvikinator/notion-to-md/issues/58#issuecomment-1455556816

souvikinator commented 1 year ago

Page 1

    This is the content of the page 1

    [Page 1.1](13860609-1fa5-417a-9be2-729fb83706bf)

            This is the content of Page 1.1

so the problem with this is, due to indentation the markdown parser treats it as a code block as you can see here as well. After the fix hopefully, the indentation won't be there.

abudhakeer commented 1 year ago

Gentle reminder @souvikinator

souvikinator commented 1 year ago

Hey, @abudhakeer just to give you an update I'm working on it and the fix should be live in the upcoming update along with other features. Thanks for your patience :))

abudhakeer commented 1 year ago

Awesome. Thank you for the update. BTW, any approx timeline for the next release ser?

souvikinator commented 1 year ago

End of the week hopefully.

souvikinator commented 1 year ago

@abudhakeer PR #67 should fix the issue, works fine on my end. Can you confirm?