From d5dc306314cfdbc3b4d16405a7e9716ceb5fac17 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 20 Mar 2024 13:34:47 +0000 Subject: [PATCH] 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. --- apps/docs/scripts/utils.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/docs/scripts/utils.ts b/apps/docs/scripts/utils.ts index bd3f1f82f..377cb18a4 100644 --- a/apps/docs/scripts/utils.ts +++ b/apps/docs/scripts/utils.ts @@ -11,9 +11,7 @@ import { DocSoftBreak, } from '@microsoft/tsdoc' import assert from 'assert' -import GithubSlugger from 'github-slugger' - -const slugs = new GithubSlugger() +import { slug as githubSlug } from 'github-slugger' import path from 'path' import prettier from 'prettier' @@ -50,7 +48,7 @@ function isOnParentPage(itemKind: ApiItemKind) { } export function getSlug(item: ApiItem): string { - return slugs.slug(item.displayName, true) + return githubSlug(item.displayName, true) } export function getPath(item: ApiItem): string {