forked from cheminfo/nmrium-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docusaurus.config.js
98 lines (97 loc) · 2.72 KB
/
docusaurus.config.js
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
/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
title: 'NMRium documentation',
tagline:
'Learn how to use NMRium, the react component to view and process NMR spectra',
url: 'https://docs.nmrium.org',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'cheminfo',
projectName: 'nmrium-docs',
plugins: [
[
require.resolve('@easyops-cn/docusaurus-search-local'),
{
// ... Your options.
// `hashed` is recommended as long-term-cache of index file is possible.
hashed: true,
docsRouteBasePath: '/',
},
],
],
themeConfig: {
navbar: {
title: '',
logo: {
alt: 'NMRium Logo',
src: 'img/nmrium-logo.svg',
},
items: [
{
to: '/',
activeBasePath: 'docs',
label: 'Docs',
position: 'left',
},
{ to: 'blog', label: 'Blog', position: 'left' },
{
href: 'https://github.com/cheminfo/nmrium-docs',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
copyright: `Copyright © ${new Date().getFullYear()} NMRium contributors. Built with Docusaurus.`,
},
hideableSidebar: true,
},
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
sidebarItemsGenerator: async function ({
defaultSidebarItemsGenerator,
...args
}) {
const sidebarItems = await defaultSidebarItemsGenerator(args);
return raisingSingleNodes(sidebarItems);
}, // Please change this to your repo.
editUrl: 'https://github.com/cheminfo/nmrium-docs/edit/master/',
routeBasePath: '/',
},
blog: {
showReadingTime: true,
// Please change this to your repo.
editUrl:
'https://github.com/facebook/docusaurus/edit/master/website/blog/',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
},
],
],
};
function raisingSingleNodes(items) {
// we need to traverse the full hierarhy and if there is only one child items we raise it one level
for (let parentItem of items) {
if (parentItem && parentItem.items && parentItem.items.length) {
for (let i = 0; i < parentItem.items.length; i++) {
if (
parentItem.items[i].items &&
parentItem.items[i].items.length === 1
) {
parentItem.items[i] = parentItem.items[i].items[0];
}
}
raisingSingleNodes(parentItem.items);
}
}
return items;
}