gatsby-remark-table-of-contents icon indicating copy to clipboard operation
gatsby-remark-table-of-contents copied to clipboard

Dot and Ampersand rendered differently to how Gatsby renders them in anchors

Open bharatrajagopalan opened this issue 4 years ago • 2 comments

Dots and ampersands are rendered differently in TOC compared to Gatsby

A.B help

Gatsby generated link #a.b-help TOC generated link: #ab-help

missing the .

A & B help

Gatsby converts & to and while TOC just ignores it

Gatsby link: #a-and-b-help TOC link: #a--b-help

bharatrajagopalan avatar Nov 30 '20 18:11 bharatrajagopalan

@bharatrajagopalan thank you for the report! hmm... that's really not good. To generate the TOC itself I use mdast-util-toc this itself uses then github-slugger for the slug-generation. The gatsby-remark-autolink-headers uses also github-slugger. Did you do any research where the difference could come from?

signalwerk avatar Dec 07 '20 10:12 signalwerk

@signalwerk

I managed to work out a few bits.I am using the Gatsby carbon theme https://gatsby-theme-carbon.now.sh

I am trying to work out what it uses internally, but it is highly likely that it doesn't use gatsby-remark-autolink-headers

I installed gatsby-remark-autolink-headers on top and it basically resulted in additional ids prefixed with object-

From your perspective given that the gatsby-remark-table-contents is designed to work with gatsby-remark-autolink-headers as a pre-requisite, arguably this is beyond your scope to fix. If you agree then I will close this issue accordingly.

bharatrajagopalan avatar Dec 07 '20 10:12 bharatrajagopalan