Skip to content

Commit 98b939d

Browse files
committed
fix: docs sidebar renderer
1 parent f6e5951 commit 98b939d

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

apps/website/docusaurus.config.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ import type * as Preset from '@docusaurus/preset-classic';
44

55
const UPPERCASE = new Set(['jsx', 'cli', 'api']);
66

7+
const maybeUpperCase = (str: string) => {
8+
const chunks = str.split(' ');
9+
return chunks
10+
.map((chunk) => {
11+
if (UPPERCASE.has(chunk.toLowerCase())) {
12+
return chunk.toUpperCase();
13+
}
14+
15+
return chunk;
16+
})
17+
.join(' ');
18+
};
19+
720
const config: Config = {
821
title: 'CommandKit',
922
tagline: 'A Discord.js handler',
@@ -38,9 +51,11 @@ const config: Config = {
3851
...item,
3952
label: UPPERCASE.has(item.label?.toLowerCase())
4053
? item.label.toUpperCase()
41-
: item.label
42-
.replace(/-/g, ' ')
43-
.replace(/\b\w/g, (char) => char.toUpperCase()),
54+
: maybeUpperCase(
55+
item.label
56+
.replace(/-/g, ' ')
57+
.replace(/\b\w/g, (char) => char.toUpperCase()),
58+
),
4459
items: item?.items?.map?.(transform),
4560
};
4661
}

0 commit comments

Comments
 (0)