Skip to content

feat: add indentDepth prop to TOCInline component #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tomelliot
Copy link

The new features in v1 blog post for the tailwind-nextjs-starter-blog repo says

By default, all headings that are of depth 3 or smaller are indented. This can be configured by changing the indentDepth property.

But this property and feature doesn't exist in the package.

I couldn't run any tests or anything to check if this worked (none available in the repo), but I think this works 🤞

Copy link

changeset-bot bot commented Apr 10, 2025

⚠️ No Changeset found

Latest commit: ecebc68

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@timlrx
Copy link
Owner

timlrx commented Apr 11, 2025

Sorry for the confusion, indentDepth was removed in the following commit 61fa6f0 since I decided to add support for nested table of content so the nested headers are automatically indented. I no longer see a need for indentDepth but you can let me know if you think otherwise?

The modifications also appears to cause it to be double indented as the nested indents are already indented in this line: https://github.com/timlrx/pliny/blob/main/packages/pliny/src/ui/TOCInline.tsx#L108

@tomelliot
Copy link
Author

tomelliot commented Apr 11, 2025

Hmm - I might be missing something, but from what I'm seeing, that works differently from what I'm hoping:

  • It only applies for TOCs with asDisclosure=true
  • It only applies one ml-6 at the top level. It doesn't apply additional ml-6 for each heading sublevel

What I'm hoping for:

H1
H1
  H2
  H2
    H3
    H3
H1
  H2
H1

The modifications also appears to cause it to be double indented as the nested indents are already indented in this line: https://github.com/timlrx/pliny/blob/main/packages/pliny/src/ui/TOCInline.tsx#L108

This only indents the whole TOC (for disclosure/collapsible TOC), not each individual heading sublevel

@tomelliot
Copy link
Author

@timlrx if you're interested in including this functionality but need something else in the PR just let me know, otherwise feel free to close it if it's not relevant.

@timlrx
Copy link
Owner

timlrx commented Apr 15, 2025

Ok thanks for the clarification. I agree that it would be nice to support indentation at various sub-heading level. I am on a break for the next two weeks so will review later.

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.

2 participants