f8f100633f
Reviewed-on: #2 Co-authored-by: Arswarog <arswarog@yandex.ru> Co-committed-by: Arswarog <arswarog@yandex.ru>
134 lines
3.8 KiB
TypeScript
134 lines
3.8 KiB
TypeScript
import fs from 'fs';
|
|
import yaml from 'js-yaml';
|
|
import {themes as prismThemes} from 'prism-react-renderer';
|
|
import type {Config} from '@docusaurus/types';
|
|
import type * as Preset from '@docusaurus/preset-classic';
|
|
import type {NavbarItem} from '@docusaurus/theme-common'
|
|
|
|
interface DocsConfig {
|
|
title: string;
|
|
project: { org: string; repo: string };
|
|
dirs?: { docs?: string; blog?: string };
|
|
}
|
|
|
|
const docsConfig = yaml.load(fs.readFileSync('./.docuservix.yml', 'utf8')) as DocsConfig;
|
|
|
|
const {
|
|
title,
|
|
} = docsConfig
|
|
|
|
const url = process.env.DOCUSERVIX_URL;
|
|
|
|
const {
|
|
org,
|
|
repo
|
|
} = docsConfig.project
|
|
|
|
const {
|
|
docs: docsDir = 'docs',
|
|
blog: blogDir
|
|
} = docsConfig.dirs || {}
|
|
|
|
const giteaUrl = 'https://git.jt4d.ru';
|
|
const onBrokenLinks = (process.env.DOCUSERVIX_ON_BROKEN_LINKS as Config['onBrokenLinks']) || 'throw';
|
|
|
|
const config: Config = {
|
|
title,
|
|
favicon: 'img/favicon.ico',
|
|
|
|
markdown: {
|
|
mermaid: true,
|
|
},
|
|
themes: ['@docusaurus/theme-mermaid'],
|
|
|
|
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
|
|
future: {
|
|
v4: true, // Improve compatibility with the upcoming Docusaurus v4
|
|
},
|
|
|
|
// Set the production url of your site here
|
|
url,
|
|
// Set the /<baseUrl>/ pathname under which your site is served
|
|
// For GitHub pages deployment, it is often '/<projectName>/'
|
|
baseUrl: '/',
|
|
|
|
// GitHub pages deployment config.
|
|
// If you aren't using GitHub pages, you don't need these.
|
|
organizationName: org,
|
|
projectName: repo,
|
|
|
|
onBrokenLinks,
|
|
|
|
// Even if you don't use internationalization, 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: 'ru',
|
|
locales: ['ru'],
|
|
},
|
|
|
|
presets: [
|
|
[
|
|
'classic',
|
|
{
|
|
blog: {
|
|
showReadingTime: true,
|
|
feedOptions: {
|
|
type: ['rss', 'atom'],
|
|
xslt: true,
|
|
},
|
|
// Useful options to enforce blogging best practices
|
|
onInlineTags: 'warn',
|
|
onInlineAuthors: 'warn',
|
|
onUntruncatedBlogPosts: 'warn',
|
|
},
|
|
theme: {
|
|
customCss: './src/css/custom.css',
|
|
},
|
|
} satisfies Preset.Options,
|
|
],
|
|
],
|
|
|
|
themeConfig: {
|
|
// Replace with your project's social card
|
|
image: 'img/docusaurus-social-card.jpg',
|
|
colorMode: {
|
|
respectPrefersColorScheme: true,
|
|
},
|
|
navbar: {
|
|
title: title,
|
|
logo: {
|
|
alt: 'Logo',
|
|
src: 'img/logo.svg',
|
|
},
|
|
items: [
|
|
{
|
|
to: '/docs',
|
|
label: 'Документация',
|
|
position: 'left',
|
|
},
|
|
blogDir ? {
|
|
to: '/blog',
|
|
label: 'Блог',
|
|
position: 'left'
|
|
} : undefined,
|
|
{
|
|
href: `${giteaUrl}/${org}/${repo}`,
|
|
label: 'Gitea',
|
|
position: 'right',
|
|
},
|
|
].filter((item): item is NavbarItem => !!item),
|
|
},
|
|
footer: {
|
|
style: 'dark',
|
|
copyright: `Проект хостится на JT4D.ru, документация собрана с использованием Docuservix и Docusaurus.`,
|
|
},
|
|
prism: {
|
|
theme: prismThemes.github,
|
|
darkTheme: prismThemes.dracula,
|
|
},
|
|
} satisfies Preset.ThemeConfig,
|
|
};
|
|
|
|
export default config;
|