Skip to content

feat: Table of Contents Component - #241

Closed
Shadowfita wants to merge 0 commit into
docmost:mainfrom
Shadowfita:main
Closed

Shadowfita wants to merge 0 commit into
docmost:mainfrom
Shadowfita:main

Conversation

@Shadowfita

@Shadowfita Shadowfita commented Sep 2, 2024 •

Copy link
Copy Markdown
Contributor

This pull request adds an mvp table of contents component and resolves #204 and resolves #95 . I plan to add a node menu for style options, unsure if you would like to wait for those additions before considering.

I did some testing of the headings filter loop and it seldomly fires, so there shouldn't be a performance concern there. Happy to amend to match any codebase conventions however.

There may be some unnecessary code in the editor-ext lib, I'm not extremely familiar with tiptap editor extensions.

@Shadowfita

Shadowfita commented Sep 3, 2024 •

Copy link
Copy Markdown
Contributor Author

After further consideration, I will update this to include options in the menu to toggle between "Table of Contents" and "table of Child Pages" for #95 . Additionally, I will explore adding options for the table of contents to be in a sidebar, or floating based on scroll.

@Shadowfita
Shadowfita marked this pull request as draft September 3, 2024 02:17
@Shadowfita

Shadowfita commented Sep 4, 2024 •

Copy link
Copy Markdown
Contributor Author

Recent commits should now resolve #95 .

image

image

@Philipinho

Copy link
Copy Markdown
Member

Thank you for your contribution. The work looks promising, but I have a few reservations.

At this stage, I’d prefer a floating TOC that is accessible on all pages over a Tiptap node extension. We can work more on the TOC positioning later.

While the heading TOC and child pages TOC features are valuable, I don't think we're ready to implement them just yet. However, your current code will be very useful when we decide to move in that direction.

Thank you for your work.

@Shadowfita

Copy link
Copy Markdown
Contributor Author

Thanks @Philipinho. I hope it can be of value. May I ask what your reservations are outside of having it across all pages rather than a node extension?

@Philipinho

Copy link
Copy Markdown
Member

@Shadowfita I would not want to make this an editor node when we can have a global TOC available on all pages by default. It saves us more nodes to maintain.
If there are more requests in the future, I could reconsider.

@Shadowfita

Copy link
Copy Markdown
Contributor Author

I have rebased my fork and created the appropriate branches for my pull requests, I will be re-opening the PR from the correct branch for this feature for future consideration @Philipinho , no action to take, just an FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Table of Content macro [Feature Request] Table of Contents and Table of Child Pages

2 participants