Files
actual/docusaurus.config.js
Michael Clark 5e6efe0f45 Change search plugin to a more accurate one (#771)
The search tool we use has always been a bit clunky for me. There's no
keyboard shortcut support, it doesn't look great, doesn't support react
19, and I had to write a theme sync function for it to work properly
with Docusaurus V3.

The package I've upgraded here fixes all those issues. I've also updated
all the packages to the latest version, and aligned the node support
with the Actual repo.

**Old (very inaccurate search):**

<img width="885" height="573" alt="image"
src="https://github.com/user-attachments/assets/eae157de-8282-412f-b89c-618f3e3e99e5"
/>

**New:** 

<img width="676" height="605" alt="image"
src="https://github.com/user-attachments/assets/145db22f-8216-4e3f-9a98-a8bd469f1494"
/>

It also comes with a fancy new search page when you click _See all
results_
2025-08-10 19:56:26 +01:00

199 lines
5.3 KiB
JavaScript

// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const { themes } = require('prism-react-renderer');
const defaultOptions = {
editUrl: 'https://github.com/actualbudget/docs/tree/master/',
beforeDefaultRemarkPlugins: [require('./src/remark/mentions')],
};
/** @type {import('@docusaurus/types').Config} */
module.exports = {
title: 'Actual Budget Documentation',
tagline: 'Your finances - made simple',
url: 'https://actualbudget.org/',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
// 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'],
},
markdown: {
mermaid: true,
},
themes: ['@docusaurus/theme-mermaid'],
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: 'docs',
sidebarPath: require.resolve('./docs-sidebar.js'),
...defaultOptions,
},
blog: {
...defaultOptions,
feedOptions: {
type: 'rss',
title: 'Actual Budget Blog',
description:
'Stay updated with the latest blog posts from Actual Budget',
copyright: `Copyright © ${new Date().getFullYear()} Actual Budget. All rights reserved.`,
},
onUntruncatedBlogPosts: 'ignore',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
logo: {
alt: 'Actual Open Source',
src: 'img/actual.png',
},
items: [
{
to: '/#features',
// never render as active
activeBaseRegex: '^$',
label: 'Features',
position: 'left',
},
{
type: 'doc',
docId: 'index',
label: 'Docs',
position: 'left',
},
{
to: 'blog',
label: 'Blog',
position: 'left',
},
{
to: '/contact',
label: 'Contact',
position: 'left',
},
{
to: '/download',
label: 'Download',
position: 'left',
},
{
href: 'https://opencollective.com/actual',
label: 'Donate',
position: 'left',
},
{
href: 'https://discord.gg/8JfAXSgfRf',
label: 'Discord',
position: 'right',
},
{
href: 'https://github.com/actualbudget/actual',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
label: 'Discord',
href: 'https://discord.gg/8JfAXSgfRf',
},
{
label: 'GitHub',
href: 'https://github.com/actualbudget/actual',
},
{
href: 'https://opencollective.com/actual',
label: 'Donate',
},
{
label: 'Website Source',
href: 'https://github.com/actualbudget/docs',
},
{
label: 'Privacy Policy',
to: '/docs/privacy-policy',
},
{
label: 'RSS Feed',
href: 'https://actualbudget.org/blog/rss.xml',
},
],
copyright: `Copyright © ${new Date().getFullYear()} Actual Budget. Built with Docusaurus.`,
},
prism: {
theme: themes.github,
darkTheme: themes.dracula,
additionalLanguages: ['nginx'],
},
colorMode: {
defaultMode: 'light',
disableSwitch: false,
respectPrefersColorScheme: true,
},
zoom: {
// See: https://github.com/timmywil/panzoom for available options
disableZoom: true,
// A list of selectors to look for elements to enable pan and zoom
selectors: [
'div.mermaid[data-processed="true"]:not(.panzoom-exclude *)',
'div.docusaurus-mermaid-container:not(.panzoom-exclude *)',
'.drawio',
'.panzoom-example',
],
// Whether to wrap the panzoom items in a div with overflow:hidden
// This constrains the pan zoom detail into the original container
wrap: true,
// The amount of time to wait in MS before the plugin client module tries to look for
// and alter pan zoom elements. Some renders take a little bit before they appear in the
// dom to find.
timeout: 2000,
excludeClass: 'panzoom-exclude',
toolbar: {
enabled: true,
},
},
}),
plugins: [
[
require.resolve('@easyops-cn/docusaurus-search-local'),
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
({
hashed: true,
indexDocs: true,
indexPages: false,
language: 'en',
}),
],
['@docusaurus/plugin-ideal-image', { disableInDev: false }],
'@r74tech/docusaurus-plugin-panzoom',
],
};