tukanium
tukanium

Reputation: 926

How to create a TOC with accents in Markdown?

I am writing a tutorial in Markdown and created a TOC with the extension Markdown TOC on Visual Studio Code.

It is working well except when using accents. The TOC is created the same way, but when the link is clicked, it doesn't go to the right section or move. This is annoying because I am doing this in French and have a hard time finding words without any accents as "é" or "è" are common characters.

What I don't understand is why does it work great on VSC's preview, but when I push it with Github Desktop and open it in the browser, it doesn't.

<!-- TOC -->

- [Affichage, ajout et modification de données](#affichage-ajout-et-modification-de-données)
    - [Présentation](#présentation)
    - [Affichage des tableaux de données](#affichage-des-tableaux-de-données)
    - [Rechercher un contenu](#rechercher-un-contenu)
    - [Ajout de données](#ajout-de-données)
    - [Édition, duplication et suppression de fiches](#édition-duplication-et-suppression-de-fiches)
        - [Édition d'une fiche](#édition-dune-fiche)
        - [Duplication d'une fiche](#duplication-dune-fiche)
        - [Suppression d'une fiche](#suppression-dune-fiche)
- [Exemple d'ajout de données dans un catalogue](#exemple-dajout-de-données-dans-un-catalogue)
    - [Concept](#concept)
        - [Types de fiches et liens](#types-de-fiches-et-liens)
        - [Ajout d'une fiche](#ajout-dune-fiche)

<!-- /TOC -->

This is what the TOC looks like in my document. [Duplication d'une fiche](#duplication-dune-fiche) is working like it is supposed to, but not [Édition d'une fiche](#édition-dune-fiche).

Also, when inspecting the page in Chrome, I can see that the "é" isn't correct in the link: screenshot of the weird link.

Is there a way to create a markdown TOC that supports special characters ?

Upvotes: 4

Views: 1151

Answers (2)

Leonel Domagalski
Leonel Domagalski

Reputation: 1

You can also disable the setting "Markdown > Extension > TOC: Update on Save". It worked for me, I was trying to link some titles with the topic on a sumary but every time I saved the project the words with accent were automatically correcteds

Upvotes: 0

tukanium
tukanium

Reputation: 926

So I finally found out a way around this.

First, this works when titles don't have any accent:

<!-- TOC -->
- [Rechercher un contenu](#rechercher-un-contenu)
<!-- /TOC -->

# Rechercher un contenu

Now if the title has accents like é, è, à, ü, etc just place a link with an id attribute before the actual title and reference it in the TOC like so:

<!-- TOC -->
- [Ajout de données](#ajoutdonnees)
<!-- /TOC -->

<a id="ajoutdonnees"></a>
# Ajout de données

Upvotes: 3

Related Questions