Skip to content

Commit

Permalink
chore(docs): use native capitalize option
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt committed Sep 27, 2024
1 parent 1706187 commit 16058b7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions website/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
import { capitalize } from 'es-toolkit'
import { ModuleKind, ModuleResolutionKind } from 'typescript'
import { defineConfig } from 'vitepress'
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
Expand Down Expand Up @@ -27,7 +26,7 @@ const fixTitles = (sidebarMulti: SidebarMulti) => {
return sidebarMultiVisitItems(sidebarMulti, (sidebarItem) => {
const [title, maybeHtml] = sidebarItem.text?.split('<') as [string, string | undefined]
if (sidebarItem.text) {
sidebarItem.text = title.replaceAll(/-/g, ' ').split(' ').map(capitalize).join(' ')
sidebarItem.text = title.replaceAll(/-/g, ' ').split(' ').join(' ')
+ (maybeHtml ? `<${maybeHtml}` : '')
}
})
Expand All @@ -46,12 +45,12 @@ const sidebars = fixTitles(fixLinks(generateSidebar([
useTitleFromFileHeading: true,
// https://github.com/jooy2/vitepress-sidebar/issues/176
// hyphenToSpace: true,
// capitalizeEachWords: true,
capitalizeEachWords: true,
keepMarkdownSyntaxFromTitle: true,
},
{
// hyphenToSpace: true,
// capitalizeEachWords: true,
capitalizeEachWords: true,
scanStartPath: 'content/examples',
resolvePath: '/examples/',
prefixSeparator: '_',
Expand Down

0 comments on commit 16058b7

Please sign in to comment.