Skip to content

Commit 86af28c

Browse files
committed
build: install & configure tabs plugin
1 parent 7530024 commit 86af28c

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

bun.lockb

447 Bytes
Binary file not shown.

docs/.vitepress/config.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import spec from '../public/openapi.json' with { type: 'json' }
77
import container from 'markdown-it-container'
88
import { bundledLanguages } from 'shiki'
99
import { join, dirname } from 'node:path'
10+
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
1011

1112
const sidebar = useSidebar({ spec, collapsible: true })
1213

@@ -578,6 +579,7 @@ export default defineConfig({
578579
}
579580
}
580581
})
582+
md.use(tabsMarkdownPlugin)
581583
},
582584
theme: {
583585
light: 'github-light',

docs/.vitepress/theme/index.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import "./scrollbar.css";
1818
import "./tailwind.postcss";
1919
import "vitepress-openapi/dist/style.css";
2020

21+
// Import plugins
22+
import { enhanceAppWithTabs } from "vitepress-plugin-tabs/client";
23+
2124
// @ts-ignore
2225
import spec from "../../public/openapi.json" assert { type: "json" };
2326

@@ -40,13 +43,15 @@ export default {
4043
extends: DefaultTheme,
4144
Layout: Landing,
4245
enhanceApp({ app, router, siteData }) {
46+
enhanceAppWithTabs(app);
47+
4348
const openapi = useOpenapi({
4449
spec,
4550
base: "/docs/api-reference/api/operations/",
4651
label: "API",
4752
});
4853

49-
theme.enhanceApp({ app, openapi })
54+
theme.enhanceApp({ app, openapi });
5055
app.component("Card", Card);
5156
app.component("CardGroup", CardGroup);
5257
app.component("LandingSection", Sections);
@@ -60,21 +65,25 @@ export default {
6065
app.component("Browser", Browser);
6166

6267
router.onAfterRouteChange = () => {
63-
if (typeof window !== 'undefined' && (window as any).plausible) {
64-
(window as any).plausible('pageview')
68+
if (typeof window !== "undefined" && (window as any).plausible) {
69+
(window as any).plausible("pageview");
6570
}
66-
}
67-
app.directive('plausible', {
71+
};
72+
app.directive("plausible", {
6873
mounted(el: HTMLElement, binding: DirectiveBinding) {
69-
const eventName = binding.arg
70-
const eventData = binding.value || {}
74+
const eventName = binding.arg;
75+
const eventData = binding.value || {};
7176

72-
el.addEventListener('click', () => {
73-
if (typeof window !== 'undefined' && (window as any).plausible && eventName) {
74-
(window as any).plausible(eventName, { props: eventData })
77+
el.addEventListener("click", () => {
78+
if (
79+
typeof window !== "undefined" &&
80+
(window as any).plausible &&
81+
eventName
82+
) {
83+
(window as any).plausible(eventName, { props: eventData });
7584
}
76-
})
77-
}
78-
})
85+
});
86+
},
87+
});
7988
},
8089
} satisfies Theme;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"vite-plugin-llms": "^1.0.2",
1515
"vite-plugin-yaml": "^1.0.5",
1616
"vitepress": "1.6.3",
17+
"vitepress-plugin-tabs": "^0.6.0",
1718
"vue": "^3.5.13"
1819
},
1920
"postcss": {

0 commit comments

Comments
 (0)