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.08k stars 90 forks source link

Support of Table of Contents #49

Closed hrithwikbharadwaj closed 1 year ago

hrithwikbharadwaj commented 1 year ago

Is there a possibility to make a Table of Contents from notion work?

I am using notion-to-md for my blog and wanted to see what can be done

souvikinator commented 1 year ago

Not sure how the package processess the table of contents however table of contents is similar to list of links. We can return table of contents as links so that they can be used as the user wants.

your thoughts?

hrithwikbharadwaj commented 1 year ago

Figured out a way to do this if the usecase is for blogs. Users can use something like rehype toc to convert the mdnString to a TOC or write a custom function.

For now, I wrote a Custom Function since rehype is not that flexible with styling and other things like being sticky after the scroll.

I think there is no support needed from notion-to-md