Skip to content
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

Incorrect table of contents links when page contains multiple headers with the same description #1021

Open
nunogoncalves03 opened this issue Apr 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@nunogoncalves03
Copy link
Member

There is an issue with the table of contents generator on the distributed transactions page. This occurs because both the main header and a section header have identical descriptions ("Transações Distribuídas"). Consequently, the generator incorrectly links the section header with the main one, omitting the -1 index in the link. That is, the link should appear as https://resumos.leic.pt/sd/transacoes-distribuidas/#transações-distribuídas-1 instead of https://resumos.leic.pt/sd/transacoes-distribuidas/#transações-distribuídas.

How is the table of contents generated? Do you believe this issue can be addressed?

@nunogoncalves03 nunogoncalves03 added the bug Something isn't working label Apr 2, 2024
@diogotcorreia
Copy link
Member

This seems like an issue with upstream gatsby-remark-table-of-contents.

Looks like the problem is here, https://github.com/signalwerk/gatsby-remark-table-of-contents/blob/81fedb723b1fc8308498294f68cd4d2df0f1b40f/src/index.js#L56-L60, since changing the TOC to the following works:

```toc
from-heading: 1
```

Basically, the util that is generating the ToC has no idea the other header exists, so it doesn't change the link accordingly.

I'll open an issue upstream and see if it can be fixed, but the last commit is over an year old, so I'm not sure if the project is still active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants