vue-notion icon indicating copy to clipboard operation
vue-notion copied to clipboard

Maybe consider adding Table of Contents support

Open brachkow opened this issue 1 year ago • 3 comments

Hi! We are migrating our big project from vue3-notion to vue-notion, and we stumbled upon the fact that the table of contents is not displayed.

I know that in README table of contents marked as not planned, but it is clearly implementable (see https://github.com/NotionX/react-notion-x that is recommended by OG react-notion) so maybe you consider adding it?

brachkow avatar Apr 10 '23 18:04 brachkow

Sure, 👍 I'll look into it in the next days

janniks avatar Apr 10 '23 18:04 janniks

Sorry that I still haven’t gotten to this yet

janniks avatar May 09 '23 23:05 janniks

@janniks you can see how I implemented table of contents in our fork — https://github.com/tough-dev-school/vue-notion/blob/main/components/NotionTableOfContents.vue

Code is messy, but I'm sure that you will get an idea.

Keep in mind important thing that I discovered: blockMap order ≠ page block order. Page block order is one which affects order of blocks on page. Using blockMap for that may lead to broken order in Table of Contents.

FYI @zernonia your fork has this bug too: https://github.com/zernonia/vue3-notion/blob/44e0d470530b7de8b3909b3b5081c7aae1d93b99/src/blocks/table-of-contents.vue#L18. And btw, thanks a lot for clever ideas on porting this library.

brachkow avatar Nov 27 '23 13:11 brachkow