-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
220 lines (206 loc) · 7.52 KB
/
Copy pathdocusaurus.config.ts
File metadata and controls
220 lines (206 loc) · 7.52 KB
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
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
const githubOwner = process.env.DOCS_GITHUB_OWNER ?? 'grobidOrg';
const githubRepo = process.env.DOCS_GITHUB_REPO ?? 'grobid-tutorial';
const docsBranch = process.env.DOCS_BRANCH ?? 'main';
const siteUrl = process.env.DOCS_SITE_URL ?? `https://${githubOwner.toLowerCase()}.github.io`;
const siteBaseUrl = process.env.DOCS_BASE_URL ?? `/${githubRepo}/`;
const githubRepoUrl = `https://github.com/${githubOwner}/${githubRepo}`;
const editBaseUrl = `${githubRepoUrl}/tree/${docsBranch}/`;
const discussionRepo = `${githubOwner}/${githubRepo}`;
const tlumaSource = process.env.DOCS_TLUMA_SOURCE ?? discussionRepo;
const giscusRepo = process.env.DOCS_GISCUS_REPO ?? discussionRepo;
// giscusRepoId and giscusCategoryId are intentionally NOT defaulted. The
// component only renders the Giscus widget when both are set — this prevents
// the "giscus is not installed on this repository" error when the Giscus
// GitHub App isn't installed on the target repo. To enable comments, set
// DOCS_GISCUS_REPO_ID and DOCS_GISCUS_CATEGORY_ID in the environment (values
// come from giscus.app after installing the GitHub App on the repo).
const giscusRepoId = process.env.DOCS_GISCUS_REPO_ID;
const giscusCategory = process.env.DOCS_GISCUS_CATEGORY ?? 'Announcements';
const giscusCategoryId = process.env.DOCS_GISCUS_CATEGORY_ID;
const giscusMapping = process.env.DOCS_GISCUS_MAPPING ?? 'og:title';
const giscusThemeDark = process.env.DOCS_GISCUS_THEME_DARK ?? 'noborder_dark';
const giscusThemeLight = process.env.DOCS_GISCUS_THEME_LIGHT ?? 'light';
const config: Config = {
title: 'GROBID Tutorial',
tagline: 'The fast, beginner-friendly path to your first GROBID extraction',
favicon: 'img/favicon.ico',
future: {
v4: true,
},
url: siteUrl,
baseUrl: siteBaseUrl,
organizationName: githubOwner,
projectName: githubRepo,
trailingSlash: false,
onBrokenLinks: 'warn',
markdown: {
hooks: {
onBrokenMarkdownLinks: 'warn',
},
},
customFields: {
giscus: {
repo: giscusRepo,
repoId: giscusRepoId,
category: giscusCategory,
categoryId: giscusCategoryId,
mapping: giscusMapping,
themeDark: giscusThemeDark,
themeLight: giscusThemeLight,
},
tluma: {
source: tlumaSource,
theme: process.env.DOCS_TLUMA_THEME ?? 'auto',
brandColor: process.env.DOCS_TLUMA_BRAND_COLOR ?? 'blue',
button: process.env.DOCS_TLUMA_BUTTON ?? 'bottom-right',
welcomePulse: (process.env.DOCS_TLUMA_WELCOME_PULSE ?? 'true') === 'true',
edgePadding: process.env.DOCS_TLUMA_EDGE_PADDING ?? '1rem',
autoOpen: (process.env.DOCS_TLUMA_AUTO_OPEN ?? 'false') === 'true',
desktopFullscreenByDefault: (process.env.DOCS_TLUMA_DESKTOP_FULLSCREEN ?? 'false') === 'true',
prefillStarterPrompt: process.env.DOCS_TLUMA_PREFILL_PROMPT ?? 'How do I set up GROBID with Docker, and if that fails, what should I check first?',
},
},
headTags: [
{
tagName: 'script',
attributes: {},
innerHTML: `window.tlumaConfig = ${JSON.stringify({
source: tlumaSource,
theme: process.env.DOCS_TLUMA_THEME ?? 'auto',
brandColor: process.env.DOCS_TLUMA_BRAND_COLOR ?? 'blue',
button: process.env.DOCS_TLUMA_BUTTON ?? 'bottom-right',
welcomePulse: (process.env.DOCS_TLUMA_WELCOME_PULSE ?? 'true') === 'true',
edgePadding: process.env.DOCS_TLUMA_EDGE_PADDING ?? '1rem',
autoOpen: (process.env.DOCS_TLUMA_AUTO_OPEN ?? 'false') === 'true',
desktopFullscreenByDefault: (process.env.DOCS_TLUMA_DESKTOP_FULLSCREEN ?? 'false') === 'true',
prefillStarterPrompt: process.env.DOCS_TLUMA_PREFILL_PROMPT ?? 'How do I set up GROBID with Docker, and if that fails, what should I check first?',
})};`,
},
{
tagName: 'script',
attributes: {
src: 'https://tluma.ai/widget.js',
async: 'true',
defer: 'true',
},
},
],
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
plugins: [
'./plugins/llms-txt-plugin',
],
themes: [
[
require.resolve('@easyops-cn/docusaurus-search-local'),
{
hashed: true,
docsRouteBasePath: '/',
indexBlog: false,
},
],
],
presets: [
[
'classic',
{
docs: {
sidebarPath: './sidebars.ts',
routeBasePath: '/',
editUrl: editBaseUrl,
},
blog: false,
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],
themeConfig: {
image: 'img/grobid-social-card.png',
colorMode: {
defaultMode: 'dark',
respectPrefersColorScheme: false,
},
docs: {
sidebar: {
hideable: true,
autoCollapseCategories: false,
},
},
navbar: {
title: 'GROBID Tutorial',
// No logo image — the previous one was the stock Docusaurus dinosaur
// mascot from the classic template, never replaced with a GROBID brand
// asset. Text-only title fits the minimalist theme better and avoids
// fabricating a logo for a project we don't own. To add a real logo
// later, drop a file at static/img/logo.svg and re-add the `logo: {…}`
// block here.
items: [
{
type: 'docSidebar',
sidebarId: 'docsSidebar',
position: 'left',
label: 'Tutorial',
},
{
// Reference docs live at the upstream-hosted ReadTheDocs site, not
// in this tutorial repo. Hardcoded because `githubRepoUrl` points
// at grobidOrg/grobid-tutorial after the deployment config change.
href: 'https://grobid.readthedocs.io/',
position: 'left',
label: 'Reference Docs',
},
{
href: githubRepoUrl,
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Getting Started',
items: [
{label: 'Quick Start (Docker)', to: '/getting-started/quickstart-docker'},
{label: 'Your First Extraction', to: '/getting-started/your-first-extraction'},
{label: 'Understanding the Output', to: '/getting-started/understanding-the-output'},
],
},
{
title: 'Guides',
items: [
{label: 'Docker Setup', to: '/guides/docker/docker-setup'},
{label: 'REST API', to: '/guides/api/rest-api-usage'},
{label: 'Troubleshooting', to: '/guides/troubleshooting'},
],
},
{
title: 'Community',
items: [
{label: 'GitHub Issues', href: `${githubRepoUrl}/issues`},
{label: 'GitHub Discussions', href: `${githubRepoUrl}/discussions`},
{label: 'License', href: `${githubRepoUrl}/blob/master/doc/License.md`},
{label: 'Cite GROBID', href: `${githubRepoUrl}/blob/master/doc/References.md`},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} GROBID Contributors. Licensed under Apache 2.0.`,
},
prism: {
// oneLight/oneDark — cleaner and quieter than github/dracula, tuned
// for the refined-modern theme in src/css/custom.css.
theme: prismThemes.oneLight,
darkTheme: prismThemes.oneDark,
additionalLanguages: ['bash', 'java', 'python', 'markup', 'yaml', 'json'],
},
} satisfies Preset.ThemeConfig,
};
export default config;