docs.sheetjs.com/docz/docusaurus.config.js

301 lines
11 KiB
JavaScript
Raw Normal View History

2024-04-12 01:04:37 +00:00
import {themes as prismThemes} from 'prism-react-renderer';
const math = require('remark-math');
const katex = require('rehype-katex');
2022-05-16 03:26:04 +00:00
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
/** @typedef { import('prism-react-renderer').PrismTheme['styles'] } PrismThemeStyle */
/** @typedef { import('prism-react-renderer').PrismTheme['styles'][number]['style'] } PrismThemeEntry */
2024-04-12 01:04:37 +00:00
/**
Updates styles array from prisma theme based off token type
2024-04-12 01:04:37 +00:00
@type {(theme: PrismThemeStyle, replace: Record<string, PrismThemeEntry>) => PrismThemeStyle}
*/
const updateThemeStyles = (styles, replace) => {
2024-04-12 01:04:37 +00:00
const copy = structuredClone(styles);
const types = Object.keys(replace)
copy.forEach(style => {
types.forEach((type) => {
if (style.types.includes(type)) {
style.style = { ...style.style, ...replace[type]}
}
})
})
return copy
}
2024-04-12 01:04:37 +00:00
const lightCodeTheme = prismThemes.github;
const darkCodeTheme = prismThemes.dracula;
2024-01-07 02:35:22 +00:00
2022-05-16 03:26:04 +00:00
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'SheetJS Community Edition',
tagline: 'Get Sheet Done',
url: 'https://docs.sheetjs.com',
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'],
},
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
2023-06-20 01:21:34 +00:00
showLastUpdateTime: true,
2023-05-30 06:41:09 +00:00
editUrl: 'https://git.sheetjs.com/sheetjs/docs.sheetjs.com/src/branch/master/docz',
2024-01-07 02:35:22 +00:00
remarkPlugins: [math],
rehypePlugins: [katex /* , { strict: false } */],
2022-05-16 03:26:04 +00:00
},
//blog: {
// showReadingTime: true,
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
2023-05-25 01:36:15 +00:00
// editUrl: 'https://git.sheetjs.com/sheetjs/docs.sheetjs.com/src/branch/master/docz/',
2022-05-16 03:26:04 +00:00
//},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
googleAnalytics: {
trackingID: 'UA-36810333-1',
anonymizeIP: true
2023-06-13 17:49:52 +00:00
},
gtag: {
trackingID: 'G-0TSXVXRHM6',
anonymizeIP: true
2022-05-16 03:26:04 +00:00
}
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
2023-05-25 01:36:15 +00:00
mermaid: {
options: {
themeVariables: {
edgeLabelBackground: "transparent"
2023-05-25 01:36:15 +00:00
}
}
},
2022-05-16 03:26:04 +00:00
navbar: {
title: 'SheetJS CE Docs',
logo: {
alt: 'SheetJS Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'index',
position: 'left',
label: 'Docs',
},
//{to: '/blog', label: 'Blog', position: 'left'},
{
href: 'https://sheetjs.com',
label: 'SheetJS',
position: 'right',
},
{
2023-06-07 03:48:13 +00:00
href: 'https://git.sheetjs.com/sheetjs/sheetjs/issues',
2022-05-16 03:26:04 +00:00
label: 'Source',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Intro',
to: '/docs',
},
{
2023-07-26 20:18:07 +00:00
label: 'Examples',
to: '/docs/getting-started/examples',
2022-05-16 03:26:04 +00:00
},
],
},
{
title: 'Community',
items: [
2022-11-09 08:25:37 +00:00
{
label: 'Discord',
2023-01-21 10:50:57 +00:00
href: 'https://discord.gg/sheetjs',
2022-11-09 08:25:37 +00:00
},
2022-05-16 03:26:04 +00:00
{
label: 'Twitter',
href: 'https://twitter.com/sheetjs',
},
],
},
{
title: 'More',
items: [
//{
// label: 'Blog',
// to: '/blog',
//},
{
label: 'SheetJS Pro',
href: 'https://sheetjs.com/pro',
},
{
label: 'Source',
2022-11-07 10:41:00 +00:00
href: 'https://git.sheetjs.com/sheetjs/sheetjs',
2022-05-16 03:26:04 +00:00
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} SheetJS LLC.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: {
// Dracula dark theme by default has keyword and variable font style set to italic
// reset to normal to be consistent with the light theme (github)
...darkCodeTheme,
styles: updateThemeStyles(/** @type {any} */ (darkCodeTheme.styles), {
'keyword': {
fontStyle: "normal"
},
'variable': {
fontStyle: "normal"
}
})
},
2024-10-14 04:45:51 +00:00
additionalLanguages: [ "visual-basic", "swift", "java", "php", "csharp", "perl", "ruby", "cpp", "applescript", "liquid", "rust", "dart", "wolfram", "matlab", "stata", "zig", "diff", "bash", "json", "nasm" ],
2022-05-16 03:26:04 +00:00
},
liveCodeBlock: {
playgroundPosition: 'top'
}
}),
themes: [
2022-12-28 11:56:52 +00:00
"@docusaurus/theme-live-codeblock",
"@docusaurus/theme-mermaid"
2022-05-16 03:26:04 +00:00
],
2022-12-28 11:56:52 +00:00
markdown: {
mermaid: true
},
2022-05-16 03:26:04 +00:00
scripts: [
{
src: "https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js",
async: true
}
],
2024-01-07 02:35:22 +00:00
stylesheets: [
{
href: '/katex/katex.min.css',
type: 'text/css',
crossorigin: 'anonymous',
},
],
plugins: [
2024-10-16 22:33:27 +00:00
require.resolve("sheetjs-docusaurus"),
2022-08-28 18:26:33 +00:00
require.resolve("@cmfcmf/docusaurus-search-local"),
[ '@docusaurus/plugin-client-redirects', {
redirects: [
2023-07-26 20:18:07 +00:00
{ from: '/docs/example', to: '/docs/getting-started/examples/export/' },
{ from: '/docs/getting-started/example', to: '/docs/getting-started/examples/export/' },
2022-08-28 18:26:33 +00:00
{ from: '/docs/installation', to: '/docs/getting-started/' },
2022-11-03 21:14:12 +00:00
{ from: '/docs/interface', to: '/docs/api/' },
2022-08-30 22:12:52 +00:00
{ from: '/docs/demos/excel', to: '/docs/demos/' },
{ from: '/docs/getting-started/demos/', to: '/docs/demos/' },
{ from: '/docs/getting-started/demos/excel', to: '/docs/demos/' },
2023-01-15 03:36:13 +00:00
{ from: '/docs/demos/content', to: '/docs/demos/static/' },
2023-02-18 02:33:30 +00:00
{ from: '/docs/demos/git', to: '/docs/demos/cloud/github/' },
2023-02-13 04:07:25 +00:00
{ from: '/docs/demo/grid', to: '/docs/demos/grid/' },
2023-01-09 05:08:30 +00:00
/* frontend */
{ from: '/docs/demos/angular', to: '/docs/demos/frontend/angular/' },
{ from: '/docs/demos/react', to: '/docs/demos/frontend/react/' },
{ from: '/docs/demos/svelte', to: '/docs/demos/frontend/svelte/' },
{ from: '/docs/demos/vue', to: '/docs/demos/frontend/vue/' },
{ from: '/docs/demos/bundler', to: '/docs/demos/frontend/bundler/' },
{ from: '/docs/demos/legacy', to: '/docs/demos/frontend/legacy/' },
2023-10-27 01:49:35 +00:00
{ from: '/docs/demos/rollup', to: '/docs/demos/frontend/bundler/rollup/' },
2023-10-24 06:20:57 +00:00
{ from: '/docs/getting-started/demos/legacy', to: '/docs/demos/frontend/legacy/' },
2023-10-27 01:49:35 +00:00
{ from: '/docs/getting-started/demos/bundler', to: '/docs/demos/frontend/bundler/' },
2023-01-10 00:31:37 +00:00
/* cloud */
{ from: '/docs/demos/salesforce', to: '/docs/demos/cloud/salesforce/' },
2023-10-27 01:49:35 +00:00
{ from: '/docs/getting-started/demos/salesforce', to: '/docs/demos/cloud/salesforce/' },
2023-01-10 00:31:37 +00:00
{ from: '/docs/demos/aws', to: '/docs/demos/cloud/aws/' },
{ from: '/docs/demos/azure', to: '/docs/demos/cloud/azure/' },
{ from: '/docs/demos/netsuite', to: '/docs/demos/cloud/netsuite/' },
2023-02-18 02:33:30 +00:00
{ from: '/docs/demos/gsheet', to: '/docs/demos/cloud/gsheet/' },
{ from: '/docs/demos/airtable', to: '/docs/demos/cloud/airtable/' },
2023-01-14 03:13:35 +00:00
/* extensions */
{ from: '/docs/demos/extendscript', to: '/docs/demos/extensions/extendscript/' },
{ from: '/docs/demos/excelapi', to: '/docs/demos/extensions/excelapi/' },
{ from: '/docs/demos/chromium', to: '/docs/demos/extensions/chromium/' },
2023-05-11 21:28:29 +00:00
{ from: '/docs/getting-started/demos/chromium', to: '/docs/demos/extensions/chromium/' },
/* cloud */
2023-05-03 03:40:40 +00:00
{ from: '/docs/demos/cloudata', to: '/docs/demos/cloud/' },
2023-02-18 02:33:30 +00:00
{ from: '/docs/demos/cloudata/gsheet', to: '/docs/demos/cloud/gsheet/' },
{ from: '/docs/demos/cloudata/airtable', to: '/docs/demos/cloud/airtable/' },
2023-05-11 21:28:29 +00:00
{ from: '/docs/getting-started/demos/netsuite', to: '/docs/demos/cloud/netsuite/' },
2023-02-18 02:33:30 +00:00
/* hosting */
{ from: '/docs/demos/hosting/dropbox', to: '/docs/demos/cloud/dropbox/' },
{ from: '/docs/demos/hosting/github', to: '/docs/demos/cloud/github/' },
2023-02-24 07:46:48 +00:00
/* data */
2023-10-06 20:47:17 +00:00
{ from: '/docs/getting-started/demos/database', to: '/docs/demos/data/' },
2023-02-24 07:46:48 +00:00
{ from: '/docs/demos/database', to: '/docs/demos/data/' },
2023-05-11 21:28:29 +00:00
{ from: '/docs/demos/nosql', to: '/docs/demos/data/' },
{ from: '/docs/getting-started/demos/nosql', to: '/docs/demos/data/' },
2023-02-28 11:40:44 +00:00
/* net */
{ from: '/docs/demos/headless', to: '/docs/demos/net/headless/' },
{ from: '/docs/demos/server', to: '/docs/demos/net/server/' },
{ from: '/docs/demos/network', to: '/docs/demos/net/network/' },
2023-05-11 21:28:29 +00:00
{ from: '/docs/getting-started/demos/network', to: '/docs/demos/net/network/' },
2023-02-28 11:40:44 +00:00
/* local */
{ from: '/docs/demos/clipboard', to: '/docs/demos/local/clipboard/' },
2023-10-27 01:49:35 +00:00
{ from: '/docs/getting-started/demos/clipboard', to: '/docs/demos/local/clipboard/' },
2023-02-28 11:40:44 +00:00
{ from: '/docs/demos/localfile', to: '/docs/demos/local/file/' },
2023-06-01 08:25:44 +00:00
{ from: '/docs/demos/data/indexeddb', to: '/docs/demos/local/indexeddb/' },
2023-09-18 06:44:33 +00:00
{ from: '/docs/demos/data/storageapi', to: '/docs/demos/local/storageapi/' },
2023-10-15 02:39:07 +00:00
{ from: '/docs/demos/data/websql', to: '/docs/demos/local/websql/' },
2023-02-28 11:40:44 +00:00
/* desktop */
2023-05-11 21:28:29 +00:00
{ from: '/docs/getting-started/demos/desktop', to: '/docs/demos/desktop/' },
2024-03-18 08:24:41 +00:00
/* cli */
{ from: '/docs/getting-started/demos/cli', to: '/docs/demos/cli/' },
{ from: '/docs/demos/desktop/cli', to: '/docs/demos/cli/' },
2023-02-28 11:40:44 +00:00
/* bigdata */
{ from: '/docs/demos/worker', to: '/docs/demos/bigdata/worker/' },
{ from: '/docs/demos/stream', to: '/docs/demos/bigdata/stream/' },
2024-01-03 06:47:00 +00:00
/* math */
{ from: '/docs/demos/ml', to: '/docs/demos/math/' },
{ from: '/docs/demos/bigdata/ml', to: '/docs/demos/math/' },
2024-01-30 09:27:22 +00:00
{ from: '/docs/demos/engines/pandas', to: '/docs/demos/math/pandas/' },
2023-05-03 03:40:40 +00:00
/* installation */
{ from: '/docs/installation/standalone', to: '/docs/getting-started/installation/standalone/' },
{ from: '/docs/installation/frameworks', to: '/docs/getting-started/installation/frameworks/' },
{ from: '/docs/installation/nodejs', to: '/docs/getting-started/installation/nodejs/' },
{ from: '/docs/installation/amd', to: '/docs/getting-started/installation/amd/' },
{ from: '/docs/installation/extendscript', to: '/docs/getting-started/installation/extendscript/' },
{ from: '/docs/installation/deno', to: '/docs/getting-started/installation/deno/' },
{ from: '/docs/installation/bun', to: '/docs/getting-started/installation/bun/' },
2023-11-21 07:51:15 +00:00
/* misc */
{ from: '/demos/datagrid', to: '/docs/demos/grid/' },
2022-08-28 18:26:33 +00:00
]
}]
2022-05-16 03:26:04 +00:00
]
};
module.exports = config;