fix docs slugs (#3227)

Our slug generation code uses the stateful version of github slugger
which assigns different names to different slugs e.g. `thing`,
`thing-1`, `thing-2` each time it's called. This means that our links
across pages are broken because the slugs get generated with a suffix.
This replaces it with the non-stateful version instead.
This commit is contained in:
alex 2024-03-20 13:34:47 +00:00 committed by GitHub
parent 72ae8ddefd
commit d5dc306314
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,9 +11,7 @@ import {
DocSoftBreak, DocSoftBreak,
} from '@microsoft/tsdoc' } from '@microsoft/tsdoc'
import assert from 'assert' import assert from 'assert'
import GithubSlugger from 'github-slugger' import { slug as githubSlug } from 'github-slugger'
const slugs = new GithubSlugger()
import path from 'path' import path from 'path'
import prettier from 'prettier' import prettier from 'prettier'
@ -50,7 +48,7 @@ function isOnParentPage(itemKind: ApiItemKind) {
} }
export function getSlug(item: ApiItem): string { export function getSlug(item: ApiItem): string {
return slugs.slug(item.displayName, true) return githubSlug(item.displayName, true)
} }
export function getPath(item: ApiItem): string { export function getPath(item: ApiItem): string {