-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsidebar.ts
More file actions
26 lines (23 loc) · 934 Bytes
/
sidebar.ts
File metadata and controls
26 lines (23 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { DefaultTheme } from 'vitepress'
import { genMarkdowDocs, SIDEBAR_ICONS_MAP } from '../../theme/utils/gen'
const lang = 'zh-CN'
const docsSidebar = genMarkdowDocs(lang, 'docs', { exclude: ['cli'] })
const cliSidebar = genMarkdowDocs(lang, 'docs/cli')
function buildCliSidebar(): DefaultTheme.SidebarItem[] {
const items = cliSidebar()
const installIdx = items.findIndex((item) => typeof item.link === 'string' && item.link.includes('installation'))
const githubItem: DefaultTheme.SidebarItem = {
text: `<span class="sidebar-item-icon">${SIDEBAR_ICONS_MAP.github}</span>GitHub`,
link: 'https://github.com/longbridge/longbridge-terminal',
}
if (installIdx !== -1) {
items.splice(installIdx + 1, 0, githubItem)
} else {
items.push(githubItem)
}
return items
}
export const sidebar: DefaultTheme.Sidebar = {
[`/${lang}/docs/cli`]: buildCliSidebar(),
[`/${lang}/docs`]: docsSidebar(),
}