NotionX / NotionX/react-notion-x
getPageTableOfContents() not getting headers inside Callouts
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 645
- PR merge metrics
- No merged PRs in 30d
Description
Well, it's a somewhat strange behavior that I've been seeing consistently. I've tried to test possible fixes as much as possible, but to my knowledge, it doesn't really seem to be a problem on my end.
To explain briefly, when using the getPageTableOfContents() function, it normally returns an array with all the page's headers and their information. But for some reason, when using it on pages that have callouts, and headers within those, the function returns only the external headers, ignoring the headers present within other components.
I checked on Notion, and there, headers within callouts are normally considered for the table of contents (although those within quotes are not, which is still strange, but oh well).
Could this inconsistency with the normal operation of Notion's table of contents be intentional? I apologize in advance if it's actually something I'm doing wrong, too, because I can't really deny the possibility. Anyway, thank you for your time and attention.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from getPageTableOfContents() and trace how it collects headers from pages containing callouts. Reproduce the reported case with headers inside a callout, then compare the result with the expected Notion table of contents behavior. Done means headers inside callouts are included while preserving the existing handling of external headers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100