-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocusaurus.config.js
263 lines (248 loc) · 8.79 KB
/
docusaurus.config.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config
// https://npmtrends.com/docusaurus-vs-vitepress-vs-vuepress
import { themes as prismThemes } from "prism-react-renderer";
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "Neptun",
tagline: "Automated Tech Stack Configuration powered by AI.",
favicon: "img/favicon.png",
// The production url of the site
url: "https://neptun-ai-tools-docs.pages.dev",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",
// GitHub pages deployment config.
organizationName: "neptun",
projectName: "neptun.tools.docs",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
i18n: {
defaultLocale: "en",
locales: ["en", "de"],
},
presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: "./sidebars.js",
/* docItemComponent: "@theme/ApiItem", */
editUrl: ({ docPath }) => {
if (docPath.startsWith("web-interface/api/")) {
return (
"https://github.com/neptun-software/neptun.web/edit/main/public/docs/" +
docPath.replace("web-interface/api/", "")
);
}
return (
"https://github.com/neptun-software/neptun.tools.docs/edit/main/docs/" +
docPath
);
},
},
sitemap: {
lastmod: "date",
changefreq: "weekly",
priority: 0.5,
ignorePatterns: ["/tags/**"],
filename: "sitemap.xml",
createSitemapItems: async (params) => {
const { defaultCreateSitemapItems, ...rest } = params;
const items = await defaultCreateSitemapItems(rest);
return items.filter((item) => !item.url.includes("/page/"));
},
},
theme: {
customCss: "./src/css/custom.css",
},
}),
],
],
themes: ["@docusaurus/theme-mermaid"],
markdown: {
mermaid: true,
format: "mdx",
mdx1Compat: {
comments: true,
admonitions: true,
headingIds: true,
},
},
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
image: "img/favicon.png",
colorMode: {
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: false,
},
navbar: {
title: "Neptun",
logo: {
alt: "Neptun Logo",
src: "img/logo.png",
srcDark: "img/logo-light.png",
},
items: [
{
type: "docSidebar",
sidebarId: "modelsSidebar",
position: "left",
label: "Docs",
},
{
href: "https://github.com/neptun-software",
label: "GitHub",
position: "right",
},
{
type: "localeDropdown",
},
],
},
footer: {
style: "dark",
copyright: `Copyright © ${new Date().getFullYear()} Neptun, Inc. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: ["sql", "mermaid"],
},
}),
// https://github.com/rdilweb/docusaurus-plugin-remote-content/issues/37#issuecomment-1840575140
plugins: [
require.resolve("docusaurus-lunr-search"),
"docusaurus-plugin-sass",
[
"docusaurus-plugin-remote-content",
{
name: "neptun-web-docs",
sourceBaseUrl:
"https://raw.githubusercontent.com/neptun-software/neptun.web/refs/heads/main/public/docs",
documents: [
"api-ai-huggingface-{model_publisher}-{model_name}-chat.post.md",
"api-auth-check.head.md",
"api-auth-login.post.md",
"api-auth-logout.post.md",
"api-auth-sign-up.post.md",
"api-html-to-markdown-{url}.get.md",
"api-shared-chats-{uuid}.get.md",
"api-shared-collections.get.md",
"api-shared-collections-{uuid}.get.md",
"api-users-{user_id}.delete.md",
"api-users-{user_id}.patch.md",
"api-users-{user_id}-chats.get.post.delete.md",
"api-users-{user_id}-chats-{chat_id}.delete.md",
"api-users-{user_id}-chats-{chat_id}.patch.md",
"api-users-{user_id}-chats-{chat_id}-files.get.md",
"api-users-{user_id}-chats-{chat_id}-files-{message_id}.post.md",
"api-users-{user_id}-chats-{chat_id}-messages.get.md",
"api-users-{user_id}-chats-{chat_id}-messages.post.md",
"api-users-{user_id}-chats-{chat_id}-messages-last.delete.md",
"api-users-{user_id}-chats-{chat_id}-shares.get.md",
"api-users-{user_id}-chats-{chat_id}-shares.post.md",
"api-users-{user_id}-chats-{chat_id}-shares-{share_id}-whitelist-entries.post.md",
"api-users-{user_id}-cli.get.md",
"api-users-{user_id}-collections.get.md",
"api-users-{user_id}-collections.post.md",
"api-users-{user_id}-collections-{uuid}.delete.md",
"api-users-{user_id}-collections-{uuid}.patch.md",
"api-users-{user_id}-collections-{uuid}-templates.post.md",
"api-users-{user_id}-collections-{uuid}-templates-{id}.delete.md",
"api-users-{user_id}-collections-{uuid}-templates-{id}.get.md",
"api-users-{user_id}-collections-{uuid}-templates-{id}.patch.md",
"api-users-{user_id}-installations.get.md",
"api-users-{user_id}-installations-{installation_id}-imports.get.md",
"auth-otp.post.md",
"email-{email}-reset-password.post.md",
"health.get.md",
],
outDir: "docs/web-interface/api",
modifyContent(_filename, content) {
const codeBlocks = [];
let modifiedContent = content.replace(/```[\s\S]*?```/g, (match) => {
codeBlocks.push(match);
return "###CODE_BLOCK###";
});
// replace all {token} with [token], because the markdown parser does see them as
// template literals which causes `token is not defined`, for example in the
// "Huggingface Chat Endpoint" and in the "Shared Chat Messages Endpoint"
modifiedContent = modifiedContent.replace(/{([^}]*)}/g, "[$1]");
codeBlocks.forEach((block) => {
modifiedContent = modifiedContent.replace(
"###CODE_BLOCK###",
block
);
});
return { content: modifiedContent };
},
},
],
[
"docusaurus-plugin-remote-content",
{
name: "neptun-web-schema",
sourceBaseUrl:
"https://raw.githubusercontent.com/neptun-software/neptun.web/refs/heads/main/backup/schema",
documents: ["schema.mermaid", "schema.sql"],
outDir: "docs/assets/_schema",
modifyContent(_filename, content) {
if (_filename.endsWith(".mermaid")) {
return {
filename: "schema.mermaid.md",
content: "```mermaid\n" + content?.trim() + "\n```",
};
}
if (_filename.endsWith(".sql")) {
return {
filename: "schema.sql.md",
content: "```sql\n" + content?.trim() + "\n```",
};
}
return {
content,
};
},
},
],
[
"docusaurus-plugin-remote-content",
{
name: "neptun-web-schema-image",
sourceBaseUrl:
"https://raw.githubusercontent.com/neptun-software/neptun.web/refs/heads/main/backup/schema",
documents: ["schema.png"],
outDir: "docs/assets/_schema",
requestConfig: { responseType: "arraybuffer" },
},
],
// openapi.json would need summary and operationId for this to work (waiting for nitro update...)
// [
// 'docusaurus-plugin-openapi-docs',
// {
// id: "openapi",
// docsPluginId: "classic",
// config: {
// /** @type {import('docusaurus-plugin-openapi-docs').Options} */
// neptun: {
// specPath: "https://raw.githubusercontent.com/neptun-software/neptun.web/refs/heads/main/public/docs/openapi.json",
// downloadUrl: "https://raw.githubusercontent.com/neptun-software/neptun.web/refs/heads/main/public/docs/openapi.json",
// outputDir: "docs/openapi",
// sidebarOptions: {
// groupPathsBy: "tag",
// },
// showSchemas: true,
// },
// }
// },
// ]
],
};
export default config;