aboutsummaryrefslogtreecommitdiffstats
path: root/docusaurus.config.ts
blob: 6ab300526854bec9cb8df4cfc15e716dcceae02a (plain) (blame)
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
/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 * Copyright (c) 2023-2024 Kristóf Marussy <kristof@marussy.com>
 *
 * SPDX-License-Identifier: MIT
 */

import type { Options as BlogOptions } from '@docusaurus/plugin-content-blog';
import type { Options as PagesOptions } from '@docusaurus/plugin-content-pages';
import type { Options as ClassicThemeOptions } from '@docusaurus/theme-classic';
import type { UserThemeConfig } from '@docusaurus/theme-common';
import type { Config } from '@docusaurus/types';
import { Config as SwcConfig } from '@swc/core';
import { themes } from 'prism-react-renderer';
import rehypeKatex from 'rehype-katex';
import remarkMath from 'remark-math';
import smartypants from 'remark-smartypants';

const markdownOptions = {
  remarkPlugins: [remarkMath, [smartypants, { dashes: 'oldschool' }]],
  rehypePlugins: [[rehypeKatex, { trust: true }]],
};

export default {
  title: 'Kristóf Marussy',
  url: 'https://marussy.com',
  baseUrl: '/',
  baseUrlIssueBanner: false,
  trailingSlash: true,
  staticDirectories: ['third-party/static', 'static'],
  plugins: [
    [
      '@docusaurus/plugin-content-blog',
      {
        routeBasePath: '/',
        archiveBasePath: 'blog',
        editUrl: 'https://git.marussy.com/blog/tree',
        ...markdownOptions,
        feedOptions: {
          type: 'all',
          title: 'Kristóf Marussy',
          description: "Kristóf Marussy's Blog",
        },
      } satisfies BlogOptions,
    ],
    [
      '@docusaurus/plugin-content-pages',
      markdownOptions satisfies PagesOptions,
    ],
    '@docusaurus/plugin-sitemap',
    './src/plugins/compressionPlugin.ts',
    './src/plugins/responsiveLoaderPlugin.ts',
    './src/plugins/swcMinifyPlugin.ts',
    './src/plugins/thirdPartyContentPlugin.ts',
  ],
  themes: [
    [
      '@docusaurus/theme-classic',
      {
        customCss: [require.resolve('./src/css/custom.css')],
      } satisfies ClassicThemeOptions,
    ],
  ],
  onBrokenLinks: 'warn',
  themeConfig: {
    colorMode: {
      respectPrefersColorScheme: true,
    },
    prism: {
      additionalLanguages: ['bash', 'java', 'shell-session'],
      theme: themes.oneLight,
      darkTheme: themes.oneDark,
    },
    navbar: {
      title: 'Kristóf Marussy',
      hideOnScroll: true,
      items: [
        {
          type: 'dropdown',
          label: 'About',
          to: '/',
          items: [
            {
              label: 'Research',
              to: '/#research',
            },
            {
              label: 'Publications',
              to: '/#publications',
            },
            {
              label: 'Resume',
              to: '/#resume',
            },
            {
              label: 'Contact',
              to: '/#contact',
            },
          ],
        },
        {
          label: 'Blog',
          to: '/blog',
        },
      ],
    },
    footer: {
      links: [
        {
          title: 'Pages',
          items: [
            {
              label: 'About',
              to: '/',
            },
            {
              label: 'Blog',
              to: '/blog',
            },
            {
              label: 'Tags',
              to: '/tags',
            },
          ],
        },
      ],
      copyright: 'Built with &#x2764;&#xfe0e; and Docusaurus.',
    },
  } satisfies UserThemeConfig,
  webpack: {
    // Speed up builds by using a native Javascript loader.
    // See: https://github.com/facebook/docusaurus/issues/4765#issuecomment-841135926
    // But we follow the Docusaurus upstear from
    // https://github.com/facebook/docusaurus/blob/791da2e4a1a53aa6309887059e3f112fcb35bec4/website/docusaurus.config.ts#L152-L171    // and use swc instead of esbuild.
    jsLoader: (isServer) => ({
      loader: require.resolve('swc-loader'),
      options: {
        jsc: {
          parser: {
            syntax: 'typescript',
            tsx: true,
          },
          transform: {
            react: {
              runtime: 'automatic',
            },
          },
          target: 'es2017',
        },
        module: {
          type: isServer ? 'commonjs' : 'es6',
        },
      } satisfies SwcConfig,
    }),
  },
} satisfies Config;