Skip to content

Commit 6fa26f3

Browse files
committed
feat(api): adds scalar api reference documentation
1 parent 406186a commit 6fa26f3

File tree

2 files changed

+115
-3
lines changed

2 files changed

+115
-3
lines changed

docusaurus.config.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
// @ts-check
22
// Note: type annotations allow type checking and IDEs autocompletion
3+
import type { ScalarOptions } from '@scalar/docusaurus'
34
import type { Config } from '@docusaurus/types'
45
import { themes } from 'prism-react-renderer'
5-
6+
import fs from 'fs'
67
const lightCodeTheme = themes.okaidia;
78
const darkCodeTheme = themes.okaidia;
89

10+
// Read the openapi.yaml file
11+
const specFile = fs.readFileSync('./openapi.yaml', 'utf8')
12+
913
const config: Config = {
1014
title: "Mistral AI Large Language Models",
1115
tagline: "Documentation for the deployment and usage of Mistral AI's LLMs",
@@ -154,7 +158,22 @@ const config: Config = {
154158
respectPrefersColorScheme: true,
155159
},
156160
}),
157-
plugins: [require.resolve('docusaurus-lunr-search')],
161+
plugins: [
162+
require.resolve('docusaurus-lunr-search'),
163+
[
164+
'@scalar/docusaurus',
165+
{
166+
label: 'API',
167+
route: '/api',
168+
configuration: {
169+
spec: {
170+
content: specFile,
171+
},
172+
hideDarkModeToggle: true,
173+
},
174+
} as ScalarOptions,
175+
],
176+
],
158177
};
159178

160-
module.exports = config;
179+
export default config;

src/css/api-reference.css

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
Scalar Global Variables
3+
*/
4+
:root {
5+
--scalar-color-accent: var(--ifm-color-primary);
6+
--scalar-link-color: var(--ifm-link-color);
7+
--scalar-link-color-hover: var(--ifm-link-color);
8+
--scalar-semibold: var(--ifm-font-weight-semibold);
9+
--scalar-sidebar-active-background: orange;
10+
--scalar-border-width: 1px;
11+
}
12+
13+
/*
14+
API Reference Styles
15+
*/
16+
.scalar-app {
17+
18+
/* Reset styles */
19+
h2,
20+
h3 {
21+
margin-bottom: 0;
22+
font-size: var(--scalar-font-size-1);
23+
}
24+
25+
h2 > span {
26+
display: inline-block!important;
27+
font-size: var(--scalar-font-size-4);
28+
font-weight: var(--scalar-semibold);
29+
}
30+
31+
.models-list h3 {
32+
font-size: var(--scalar-font-size-4);
33+
font-weight: var(--scalar-normal);
34+
}
35+
36+
ul {
37+
padding-left: 0;
38+
margin-bottom: 0;
39+
}
40+
41+
.parameter-item-trigger {
42+
align-items: center!important;
43+
}
44+
45+
/* Introduction code styles */
46+
.markdown code {
47+
border: none;
48+
}
49+
50+
.introduction-card-item {
51+
--scalar-border-width: 1px;
52+
}
53+
54+
/* Sidebar styles */
55+
.sidebar {
56+
.sidebar-search-input {
57+
font-size: 14px;
58+
font-weight: 400;
59+
}
60+
61+
.sidebar-heading-link {
62+
color: var(--ifm-menu-color);
63+
padding-right: 6px;
64+
}
65+
66+
.active_page.sidebar-heading p {
67+
color: var(--ifm-menu-color-active);
68+
}
69+
70+
.sidebar-heading-link:hover {
71+
color: var(--ifm-color-primary);
72+
}
73+
74+
.sidebar-indent-nested .sidebar-heading {
75+
--scalar-sidebar-indent-base: 12px;
76+
}
77+
78+
.sidebar-pages {
79+
padding-right: 0;
80+
}
81+
82+
.toggle-nested-icon {
83+
display: none;
84+
}
85+
}
86+
}
87+
88+
/*
89+
Scalar Client Modal styles
90+
*/
91+
.scalar-client {
92+
--scalar-border-width: 0.5px;
93+
}

0 commit comments

Comments
 (0)