wiki/docusaurus.config.js

218 lines
5.8 KiB
JavaScript
Raw Normal View History

2022-12-29 12:10:14 -08:00
// Note: type annotations allow type checking and IDEs autocompletion
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
2023-06-19 02:37:42 -07:00
2023-06-19 03:04:32 -07:00
const fs = require('fs');
const crypto = require('crypto');
2023-06-19 02:37:42 -07:00
const url = 'https://wiki.fome.tech';
const isBuild = process.env.NODE_ENV === 'production';
2023-06-19 03:04:32 -07:00
const pdfName = 'wiki.fome.pdf';
const pdfChecksum = () => {
const data = fs.readFileSync(`static/pdf/${pdfName}`, 'utf8');
2023-09-14 13:19:57 -07:00
return crypto.createHash('md5').update(data, 'utf8').digest('hex');
};
2023-06-19 03:04:32 -07:00
const pdfUrl = `${isBuild ? url : 'http://localhost:3000'}/pdf/${pdfName}?v=${pdfChecksum()}`;
2022-12-29 12:10:14 -08:00
/** @type {import('@docusaurus/types').Config} */
const config = {
2022-12-29 12:48:56 -08:00
title: 'FOME Wiki',
tagline: 'Free Open Motorsports ECU',
2023-06-19 02:37:42 -07:00
url,
2022-12-29 12:10:14 -08:00
baseUrl: '/',
2023-09-11 06:43:18 -07:00
// strict URL validation
2022-12-29 12:10:14 -08:00
onBrokenLinks: 'throw',
2023-09-11 06:43:18 -07:00
onBrokenMarkdownLinks: 'throw',
onDuplicateRoutes: 'throw',
2023-05-05 01:59:24 -07:00
noIndex: false, // adds <meta name="robots" content="noindex, nofollow"> to every page
favicon: 'img/icons/favicon.ico',
2023-05-07 04:16:42 -07:00
trailingSlash: true, // adds trailing slash to all links since we are using Cloudflare Pages
2022-12-29 12:10:14 -08:00
// staticDirectories: ['public', 'static'],
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
2022-12-29 12:48:56 -08:00
organizationName: 'FOME-Tech', // Usually your GitHub org/user name.
projectName: '', // Usually your repo name.
2022-12-29 12:10:14 -08:00
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: '/', // Serve the docs at the site's root
2022-12-29 12:10:14 -08:00
sidebarPath: require.resolve('./sidebars.js'),
// Remove this to remove the "edit this page" links.
2023-09-14 13:19:57 -07:00
editUrl: 'https://github.com/FOME-Tech/wiki/tree/master',
2023-06-19 02:35:39 -07:00
remarkPlugins: [require('remark-math')],
2023-09-14 13:19:57 -07:00
rehypePlugins: [[require('rehype-katex'), { output: 'mathml' }]],
2022-12-29 12:10:14 -08:00
},
blog: false,
2022-12-29 12:10:14 -08:00
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
2023-06-19 02:35:39 -07:00
stylesheets: [
{
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css',
type: 'text/css',
2023-09-14 13:19:57 -07:00
integrity: 'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM',
2023-06-19 02:35:39 -07:00
crossorigin: 'anonymous',
},
],
2023-05-07 05:09:41 -07:00
themes: [
[
require.resolve('@easyops-cn/docusaurus-search-local'),
/** @type {import('@easyops-cn/docusaurus-search-local').PluginOptions} */
({
hashed: true, // `hashed` is recommended as long-term-cache of index file is possible.
indexBlog: false,
docsRouteBasePath: '/',
}),
],
],
2023-06-02 04:30:28 -07:00
plugins: [
[
'@docusaurus/plugin-client-redirects',
{
redirects: [
// Client side redirect addresses specified in INI files (HT & TS)
// eg. https://wiki.fome.tech/r/fuel -> https://wiki.fome.tech/category/fuel/
{
from: '/r/fuel',
to: '/category/fuel/',
},
{
from: '/r/vvt',
to: '/category/vvt/',
},
{
from: '/r/debugmode',
to: '/Advanced-Features/Debug-Mode/',
},
{
from: '/r/trigger',
to: '/category/general-sensors/',
},
{
from: '/r/etb',
to: '/category/etb/',
},
{
2023-06-02 04:36:58 -07:00
from: '/r/tpstps',
2023-06-02 04:30:28 -07:00
to: '/Fuel/Acceleration/TPS-Based/',
},
{
from: '/r/lua',
to: '/Advanced-Features/LUA-Scripting/',
},
2023-06-14 01:34:30 -07:00
{
from: '/r/vr',
to: '/Hardware/Hardware-Circuits/Discrete-VR/',
},
2023-06-02 04:30:28 -07:00
],
},
],
],
2022-12-29 12:10:14 -08:00
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
image: 'img/icons/android-chrome-512x512.png',
colorMode: {
defaultMode: 'dark',
respectPrefersColorScheme: true,
},
2022-12-29 12:10:14 -08:00
navbar: {
2022-12-29 12:48:56 -08:00
title: '',
2022-12-29 12:10:14 -08:00
logo: {
2022-12-29 12:48:56 -08:00
alt: 'FOME Logo',
src: 'img/logo-transparent.png',
2023-05-05 01:53:27 -07:00
style: {
height: 30,
marginTop: -2,
2023-09-14 13:19:57 -07:00
},
2022-12-29 12:10:14 -08:00
},
items: [
{
2023-06-19 02:37:42 -07:00
href: pdfUrl,
label: 'PDF',
position: 'right',
target: '_blank',
2022-12-29 12:10:14 -08:00
},
{
href: 'https://github.com/FOME-Tech/wiki',
2022-12-29 12:10:14 -08:00
label: 'GitHub',
position: 'right',
},
{
type: 'search',
position: 'right',
},
2022-12-29 12:10:14 -08:00
],
},
footer: {
style: 'dark',
links: [
{
title: 'Community',
items: [
{
label: 'Discord',
2023-04-28 01:25:13 -07:00
href: 'https://discord.gg/5FQj4DMz',
2022-12-29 12:10:14 -08:00
},
{
2023-04-28 01:25:13 -07:00
label: 'Facebook',
href: 'https://www.facebook.com/profile.php?id=100088049271157',
2022-12-29 12:10:14 -08:00
},
],
},
{
title: 'More',
items: [
2023-05-05 01:53:27 -07:00
{
to: pdfUrl,
label: 'PDF version',
target: '_blank',
},
2023-04-28 01:25:13 -07:00
{
label: 'FOME.tech',
href: 'https://www.fome.tech',
},
2022-12-29 12:10:14 -08:00
{
label: 'GitHub',
2022-12-29 12:48:56 -08:00
href: 'https://github.com/FOME-Tech',
2022-12-29 12:10:14 -08:00
},
],
},
],
2022-12-29 12:48:56 -08:00
// copyright: `Copyright © ${new Date().getFullYear()} FOME`,
2022-12-29 12:10:14 -08:00
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
};
module.exports = config;