cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

cat/module-path
012 / website / docusaurus.config.ts
docusaurus.config.ts 5.3K
1import path from 'node:path';2import type {Config} from '@docusaurus/types';3import type * as Preset from '@docusaurus/preset-classic';4import {themes as prismThemes} from 'prism-react-renderer';5import repoLinks from './src/remark/repo-links';6// The addresses of pages that moved or went, each to where its reader7// goes now; doccheck makes sure every docs page the site has published8// is still a page or is here.9import redirects from './redirects.json';1011const repo = 'https://github.com/FelineStateMachine/012';12const repoDir = path.resolve(__dirname, '..');13const docsDir = path.join(repoDir, 'docs');1415// The navbar's sections: a label and the docs folder it opens.16const sections: [string, string][] = [17 ['Getting started', 'getting-started'],18 ['Sheets', 'sheets'],19 ['Formulas', 'formulas'],20 ['Files', 'files'],21 ['Nushell', 'nushell'],22 ['Agents', 'agents'],23 ['Terminal', 'terminal'],24];2526// The site is served at the root of its own host; SITE_URL names that27// host for canonical links and the sitemap. `forge site deploy` serves it28// under a path instead and says where with FORGE_SITE_URL and FORGE_SITE_BASE.29const forgeSite = process.env.FORGE_SITE_URL ? new URL(process.env.FORGE_SITE_URL) : null;30const url = forgeSite?.origin || process.env.SITE_URL || 'https://012.dev.site';3132const config: Config = {33 title: '012',34 tagline: 'A spreadsheet for the terminal: the look of Lotus 1-2-3, the behavior of Google Sheets.',35 favicon: 'img/favicon.svg',36 url,37 baseUrl: process.env.FORGE_SITE_BASE || '/',38 // Every page is a directory with an index.html, so plain static hosting39 // resolves each address.40 trailingSlash: true,4142 // The build is a docs check: a link or anchor that goes nowhere fails it.43 onBrokenLinks: 'throw',44 onBrokenAnchors: 'throw',45 onDuplicateRoutes: 'throw',4647 markdown: {48 // .md files are CommonMark, as GitHub reads them: <, { and HTML49 // comments are text and markup, not JSX. .mdx files would be MDX.50 format: 'detect',51 // ```mermaid blocks are drawn as diagrams, as GitHub draws them; the52 // swizzled src/theme/Mermaid gives them the site's palette.53 mermaid: true,54 hooks: {55 onBrokenMarkdownLinks: 'throw',56 onBrokenMarkdownImages: 'throw',57 },58 },5960 i18n: {defaultLocale: 'en', locales: ['en']},6162 presets: [63 [64 'classic',65 {66 docs: {67 path: docsDir,68 routeBasePath: 'docs',69 sidebarPath: './sidebars.ts',70 editUrl: `${repo}/edit/main/`,71 exclude: ['**/_*.{md,mdx}', '**/_*/**'],72 beforeDefaultRemarkPlugins: [[repoLinks, {docsDir, repoDir, blobUrl: `${repo}/blob/main`}]],73 },74 blog: false,75 theme: {customCss: './src/css/custom.css'},76 } satisfies Preset.Options,77 ],78 ],7980 // A page at each old address that sends its reader on (a static host81 // can't redirect by itself).82 plugins: [['@docusaurus/plugin-client-redirects', {redirects}]],8384 themes: [85 '@docusaurus/theme-mermaid',86 [87 '@easyops-cn/docusaurus-search-local',88 {89 hashed: true,90 indexBlog: false,91 indexPages: false,92 docsRouteBasePath: 'docs',93 docsDir: docsDir,94 highlightSearchTermsOnTargetPage: true,95 explicitSearchResultPath: true,96 },97 ],98 ],99100 themeConfig: {101 colorMode: {defaultMode: 'dark', respectPrefersColorScheme: true},102 navbar: {103 // The logomark alone: it already reads 012, so no title beside it.104 logo: {alt: '012', src: 'img/logo.svg'},105 // The docs' sections, each opening its own sidebar (sidebars.ts);106 // the landing page's control panel lists the same sections.107 items: [108 ...sections.map(([label, dir]) => ({109 type: 'docSidebar' as const,110 sidebarId: dir,111 label,112 position: 'left' as const,113 })),114 {115 type: 'docSidebar',116 sidebarId: 'reference',117 label: 'Reference',118 position: 'left',119 },120 {href: repo, label: 'GitHub', position: 'right'},121 // The mode indicator, as at the right end of 012's first line.122 {type: 'html', position: 'right', value: '<span class="mode-chip" aria-hidden="true">READY</span>'},123 ],124 },125 footer: {126 style: 'light',127 links: [128 {129 title: 'Use',130 items: [131 {label: 'Install and run', to: '/docs/getting-started/install/'},132 {label: 'The screen', to: '/docs/getting-started/the-screen/'},133 {label: 'Keys and mouse', to: '/docs/reference/keys/'},134 ],135 },136 {137 title: 'Build',138 items: [139 {label: 'Contributing', to: '/docs/contributing/'},140 {label: 'Roadmap', href: `${repo}/blob/main/ROADMAP.md`},141 {label: 'GitHub', href: repo},142 ],143 },144 ],145 copyright: `<span class="mode-chip">READY</span> 012 is free software under the <a href="${repo}/blob/main/LICENSE">MIT license</a>.`,146 },147 // The base theme is the one Mermaid lets every color of be set;148 // src/theme/Mermaid sets them from custom.css for each color mode.149 mermaid: {theme: {light: 'base', dark: 'base'}},150 prism: {151 theme: prismThemes.oneLight,152 darkTheme: prismThemes.oneDark,153 additionalLanguages: ['bash', 'sql'],154 },155 } satisfies Preset.ThemeConfig,156};157158export default config;