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

Fix README table of contents generator title linking #7

Open
1 task
fevrin opened this issue Sep 15, 2023 · 0 comments
Open
1 task

Fix README table of contents generator title linking #7

fevrin opened this issue Sep 15, 2023 · 0 comments

Comments

@fevrin
Copy link
Owner

fevrin commented Sep 15, 2023

Background

The table of contents generator does a decent job until it handles a Markdown file with duplicate titles. In that case, the titles' links all point to the same reference, whereas the links for first duplicate title on should have -1, -2, etc. appended to it to properly reference the correct title.

For instance, right now a Markdown file like this:

# Main title

${TOC}

## Subtitle

## Subtitle 2

### Subtitle

### Subtitle 2

#### Subtitle 3

#### Subtitle 2

would get a table of contents like this:

- [Subtitle](#subtitle)
- [Subtitle 2](#subtitle-2)
  - [Subtitle](#subtitle)
  - [Subtitle 2](#subtitle-2)
    - [Subtitle 3](#subtitle-3)
    - [Subtitle 2](#subtitle-2)

instead of this:

- [Subtitle](#subtitle)
- [Subtitle 2](#subtitle-2)
  - [Subtitle](#subtitle-1)
  - [Subtitle 2](#subtitle-2-1)
    - [Subtitle 3](#subtitle-3)
    - [Subtitle 2](#subtitle-2-2)

Definition of Done

  • table of contents generator correctly creates links for duplicate titles
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

No branches or pull requests

1 participant