@@ -4,8 +4,6 @@ const path = require('path');
4
4
5
5
const darkCodeTheme = require ( 'prism-react-renderer' ) . themes . dracula ;
6
6
const lightCodeTheme = require ( 'prism-react-renderer' ) . themes . github ;
7
- const katex = require ( 'rehype-katex' ) ;
8
- const math = require ( 'remark-math' ) ;
9
7
10
8
async function demoLoaderPlugin ( ) {
11
9
return {
@@ -39,171 +37,175 @@ async function demoLoaderPlugin() {
39
37
} ;
40
38
}
41
39
42
- /** @type {import('@docusaurus/types').Config } */
43
- const config = {
44
- title : 'ImageJS' ,
45
- tagline : 'Advanced image processing and manipulation in JavaScript.' ,
46
- favicon : 'img/favicon.ico' ,
40
+ /** @type {() => Promise<import('@docusaurus/types').Config> } */
41
+ async function createConfig ( ) {
42
+ const remarkPlugins = [ ( await import ( 'remark-math' ) ) . default ] ;
43
+ const rehypePlugins = [ ( await import ( 'rehype-katex' ) ) . default ] ;
44
+ return {
45
+ title : 'ImageJS' ,
46
+ tagline : 'Advanced image processing and manipulation in JavaScript.' ,
47
+ favicon : 'img/favicon.ico' ,
47
48
48
- // Set the production url of your site here
49
- url : 'https://image-js-docs.pages.dev/' ,
50
- // Set the /<baseUrl>/ pathname under which your site is served
51
- // For GitHub pages deployment, it is often '/<projectName>/'
52
- baseUrl : '/' ,
49
+ // Set the production url of your site here
50
+ url : 'https://image-js-docs.pages.dev/' ,
51
+ // Set the /<baseUrl>/ pathname under which your site is served
52
+ // For GitHub pages deployment, it is often '/<projectName>/'
53
+ baseUrl : '/' ,
53
54
54
- // GitHub pages deployment config.
55
- // If you aren't using GitHub pages, you don't need these.
56
- organizationName : 'Zakodium' , // Usually your GitHub org/user name.
57
- projectName : 'image-js' , // Usually your repo name.
55
+ // GitHub pages deployment config.
56
+ // If you aren't using GitHub pages, you don't need these.
57
+ organizationName : 'Zakodium' , // Usually your GitHub org/user name.
58
+ projectName : 'image-js' , // Usually your repo name.
58
59
59
- plugins : [
60
- demoLoaderPlugin ,
61
- [
62
- '@orama/plugin-docusaurus-v3' ,
63
- {
64
- searchbox : {
65
- disableChat : true ,
60
+ plugins : [
61
+ demoLoaderPlugin ,
62
+ [
63
+ '@orama/plugin-docusaurus-v3' ,
64
+ {
65
+ searchbox : {
66
+ disableChat : true ,
67
+ } ,
66
68
} ,
67
- } ,
69
+ ] ,
68
70
] ,
69
- ] ,
70
71
71
- onBrokenLinks : 'throw' ,
72
- onBrokenMarkdownLinks : 'warn' ,
72
+ onBrokenLinks : 'throw' ,
73
+ onBrokenMarkdownLinks : 'warn' ,
73
74
74
- // Even if you don't use internalization, you can use this field to set useful
75
- // metadata like html lang. For example, if your site is Chinese, you may want
76
- // to replace "en" with "zh-Hans".
77
- i18n : {
78
- defaultLocale : 'en' ,
79
- locales : [ 'en' ] ,
80
- } ,
75
+ // Even if you don't use internalization, you can use this field to set useful
76
+ // metadata like html lang. For example, if your site is Chinese, you may want
77
+ // to replace "en" with "zh-Hans".
78
+ i18n : {
79
+ defaultLocale : 'en' ,
80
+ locales : [ 'en' ] ,
81
+ } ,
81
82
82
- presets : [
83
- [
84
- 'classic' ,
85
- /** @type {import('@docusaurus/preset-classic').Options } */
83
+ presets : [
84
+ [
85
+ 'classic' ,
86
+ /** @type {import('@docusaurus/preset-classic').Options } */
87
+ {
88
+ docs : {
89
+ sidebarPath : require . resolve ( './sidebars.js' ) ,
90
+ // Please change this to your repo.
91
+ // Remove this to remove the "edit this page" links.
92
+ editUrl : 'https://github.com/image-js/image-js-docs/tree/main/' ,
93
+ remarkPlugins,
94
+ rehypePlugins,
95
+ } ,
96
+ blog : {
97
+ showReadingTime : true ,
98
+ blogTitle : 'Docusaurus blog!' ,
99
+ blogDescription : 'A Docusaurus powered blog!' ,
100
+ blogSidebarTitle : 'All posts' ,
101
+ blogSidebarCount : 'ALL' ,
102
+ // Please change this to your repo.
103
+ // Remove this to remove the "edit this page" links.
104
+ editUrl : 'https://github.com/image-js/image-js-docs/tree/main/' ,
105
+ } ,
106
+ theme : {
107
+ customCss : require . resolve ( './src/css/custom.css' ) ,
108
+ } ,
109
+ } ,
110
+ ] ,
111
+ ] ,
112
+ stylesheets : [
113
+ {
114
+ href :
'https://cdn.jsdelivr.net/npm/[email protected] /dist/katex.min.css' ,
115
+ type : 'text/css' ,
116
+ integrity :
117
+ 'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM' ,
118
+ crossorigin : 'anonymous' ,
119
+ } ,
120
+ ] ,
121
+ themeConfig :
122
+ /** @type {import('@docusaurus/preset-classic').ThemeConfig } */
86
123
( {
87
- docs : {
88
- sidebarPath : require . resolve ( './sidebars.js' ) ,
89
- // Please change this to your repo.
90
- // Remove this to remove the "edit this page" links.
91
- editUrl : 'https://github.com/image-js/image-js-docs/tree/main/' ,
92
- remarkPlugins : [ math ] ,
93
- rehypePlugins : [ katex ] ,
124
+ // Replace with your project's social card
125
+ image : 'img/docusaurus-social-card.jpg' ,
126
+ navbar : {
127
+ title : 'ImageJS' ,
128
+ logo : {
129
+ alt : 'ImageJS' ,
130
+ src : 'img/logo.svg' ,
131
+ } ,
132
+ items : [
133
+ {
134
+ type : 'doc' ,
135
+ docId : 'Getting started' ,
136
+ position : 'left' ,
137
+ label : 'Docs' ,
138
+ } ,
139
+ { to : '/blog' , label : 'Blog' , position : 'left' } ,
140
+ {
141
+ href : 'https://image-js.github.io/image-js-typescript/' ,
142
+ label : 'API reference' ,
143
+ position : 'left' ,
144
+ } ,
145
+ ] ,
94
146
} ,
95
- blog : {
96
- showReadingTime : true ,
97
- blogTitle : 'Docusaurus blog!' ,
98
- blogDescription : 'A Docusaurus powered blog!' ,
99
- blogSidebarTitle : 'All posts' ,
100
- blogSidebarCount : 'ALL' ,
101
- // Please change this to your repo.
102
- // Remove this to remove the "edit this page" links.
103
- editUrl : 'https://github.com/image-js/image-js-docs/tree/main/' ,
147
+ footer : {
148
+ style : 'dark' ,
149
+ links : [
150
+ {
151
+ title : 'Docs' ,
152
+ items : [
153
+ {
154
+ label : 'Getting started' ,
155
+ to : '/docs/Getting started' ,
156
+ } ,
157
+ {
158
+ label : 'Basics' ,
159
+ to : '/docs/Basics' ,
160
+ } ,
161
+ {
162
+ label : 'Features' ,
163
+ to : '/docs/Features' ,
164
+ } ,
165
+ ] ,
166
+ } ,
167
+ {
168
+ title : 'Learn' ,
169
+ items : [
170
+ {
171
+ label : 'Tutorials' ,
172
+ to : '/docs/Tutorials' ,
173
+ } ,
174
+ {
175
+ label : 'Useful tips' ,
176
+ to : '/docs/Useful tips' ,
177
+ } ,
178
+ {
179
+ label : 'Glossary' ,
180
+ to : '/docs/Glossary' ,
181
+ } ,
182
+ ] ,
183
+ } ,
184
+ {
185
+ title : 'More' ,
186
+ items : [
187
+ {
188
+ label : 'GitHub' ,
189
+ href : 'https://github.com/image-js/image-js-typescript' ,
190
+ } ,
191
+ {
192
+ label : 'API reference' ,
193
+ href : 'https://image-js.github.io/image-js-typescript/' ,
194
+ } ,
195
+ {
196
+ label : 'Zakodium' ,
197
+ href : 'https://www.zakodium.com/' ,
198
+ } ,
199
+ ] ,
200
+ } ,
201
+ ] ,
104
202
} ,
105
- theme : {
106
- customCss : require . resolve ( './src/css/custom.css' ) ,
203
+ prism : {
204
+ theme : lightCodeTheme ,
205
+ darkTheme : darkCodeTheme ,
107
206
} ,
108
207
} ) ,
109
- ] ,
110
- ] ,
111
- stylesheets : [
112
- {
113
- href :
'https://cdn.jsdelivr.net/npm/[email protected] /dist/katex.min.css' ,
114
- type : 'text/css' ,
115
- integrity :
116
- 'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM' ,
117
- crossorigin : 'anonymous' ,
118
- } ,
119
- ] ,
120
- themeConfig :
121
- /** @type {import('@docusaurus/preset-classic').ThemeConfig } */
122
- ( {
123
- // Replace with your project's social card
124
- image : 'img/docusaurus-social-card.jpg' ,
125
- navbar : {
126
- title : 'ImageJS' ,
127
- logo : {
128
- alt : 'ImageJS' ,
129
- src : 'img/logo.svg' ,
130
- } ,
131
- items : [
132
- {
133
- type : 'doc' ,
134
- docId : 'Getting started' ,
135
- position : 'left' ,
136
- label : 'Docs' ,
137
- } ,
138
- { to : '/blog' , label : 'Blog' , position : 'left' } ,
139
- {
140
- href : 'https://image-js.github.io/image-js-typescript/' ,
141
- label : 'API reference' ,
142
- position : 'left' ,
143
- } ,
144
- ] ,
145
- } ,
146
- footer : {
147
- style : 'dark' ,
148
- links : [
149
- {
150
- title : 'Docs' ,
151
- items : [
152
- {
153
- label : 'Getting started' ,
154
- to : '/docs/Getting started' ,
155
- } ,
156
- {
157
- label : 'Basics' ,
158
- to : '/docs/Basics' ,
159
- } ,
160
- {
161
- label : 'Features' ,
162
- to : '/docs/Features' ,
163
- } ,
164
- ] ,
165
- } ,
166
- {
167
- title : 'Learn' ,
168
- items : [
169
- {
170
- label : 'Tutorials' ,
171
- to : '/docs/Tutorials' ,
172
- } ,
173
- {
174
- label : 'Useful tips' ,
175
- to : '/docs/Useful tips' ,
176
- } ,
177
- {
178
- label : 'Glossary' ,
179
- to : '/docs/Glossary' ,
180
- } ,
181
- ] ,
182
- } ,
183
- {
184
- title : 'More' ,
185
- items : [
186
- {
187
- label : 'GitHub' ,
188
- href : 'https://github.com/image-js/image-js-typescript' ,
189
- } ,
190
- {
191
- label : 'API reference' ,
192
- href : 'https://image-js.github.io/image-js-typescript/' ,
193
- } ,
194
- {
195
- label : 'Zakodium' ,
196
- href : 'https://www.zakodium.com/' ,
197
- } ,
198
- ] ,
199
- } ,
200
- ] ,
201
- } ,
202
- prism : {
203
- theme : lightCodeTheme ,
204
- darkTheme : darkCodeTheme ,
205
- } ,
206
- } ) ,
207
- } ;
208
+ } ;
209
+ }
208
210
209
- module . exports = config ;
211
+ module . exports = createConfig ;
0 commit comments