Skip to content

Commit 223510c

Browse files
feat: integrate Redocusaurus for interactive OFREP OpenAPI docs page
1 parent 9be6404 commit 223510c

File tree

5 files changed

+710
-29
lines changed

5 files changed

+710
-29
lines changed

docusaurus.config.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ const themeConfig: ThemeCommonConfig & AlgoliaThemeConfig = {
172172
},
173173
prism: {
174174
theme: themes.oceanicNext,
175-
additionalLanguages: ['java', 'csharp', 'powershell', 'php', 'kotlin', 'ruby', 'dart'],
175+
additionalLanguages: ['java', 'csharp', 'powershell', 'php', 'kotlin', 'ruby', 'dart', 'scala'],
176176
magicComments: [
177177
{
178178
className: 'theme-code-block-highlighted-line',
@@ -284,7 +284,31 @@ const config: Config = {
284284
},
285285
},
286286
],
287-
presets: [['classic', presetClassicOptions]],
287+
presets: [
288+
['classic', presetClassicOptions],
289+
[
290+
'redocusaurus',
291+
{
292+
specs: [
293+
{
294+
id: 'ofrep-api',
295+
spec: 'https://raw.githubusercontent.com/open-feature/protocol/refs/heads/main/service/openapi.yaml',
296+
},
297+
],
298+
theme: {
299+
primaryColor: '#1890ff',
300+
options: {
301+
disableSearch: true,
302+
theme: {
303+
sidebar: {
304+
width: '0px',
305+
},
306+
},
307+
},
308+
},
309+
},
310+
],
311+
],
288312
plugins: [
289313
async function tailwind() {
290314
return {
@@ -363,7 +387,7 @@ const config: Config = {
363387
markdown: {
364388
mermaid: true,
365389
},
366-
themes: ['@docusaurus/theme-mermaid'],
390+
themes: ['@docusaurus/theme-mermaid', 'docusaurus-theme-redoc'],
367391
};
368392

369393
export default config;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"react-instantsearch": "^7.15.8",
5858
"react-lite-youtube-embed": "^2.5.1",
5959
"react-transition-group": "^4.4.5",
60+
"redocusaurus": "^2.5.0",
6061
"rehype-github-alerts": "^4.1.1",
6162
"remark-gfm": "^4.0.1",
6263
"remarkable": "2.0.1",
@@ -72,8 +73,8 @@
7273
"@docusaurus/tsconfig": "^3.9.1",
7374
"@types/fs-extra": "11.0.4",
7475
"@types/react": "^19.1.6",
75-
"@typescript-eslint/parser": "8.35.1",
7676
"@typescript-eslint/eslint-plugin": "8.35.1",
77+
"@typescript-eslint/parser": "8.35.1",
7778
"eslint": "^8.57.0",
7879
"eslint-config-prettier": "10.1.5",
7980
"eslint-mdx": "3.6.0",

src/css/custom.css

Lines changed: 75 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/* For readability concerns, you should choose a lighter palette in dark mode. */
2525
[data-theme='dark'] {
2626
--ifm-color-primary: #8D8DFF;
27-
--ifm-navbar-background-color: #33363A;
27+
--ifm-navbar-background-color: #33363A;
2828
}
2929

3030
.header-github-link:hover {
@@ -36,13 +36,11 @@
3636
width: 24px;
3737
height: 24px;
3838
display: flex;
39-
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E")
40-
no-repeat;
39+
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat;
4140
}
4241

4342
[data-theme='dark'] .header-github-link::before {
44-
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='white' d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E")
45-
no-repeat;
43+
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='white' d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat;
4644
}
4745

4846
.prism-code {
@@ -69,15 +67,16 @@
6967
.card-container *:last-child {
7068
margin-bottom: 0;
7169
}
72-
.code-block-diff-remove-line{
70+
71+
.code-block-diff-remove-line {
7372
background-color: #ff00001f;
7473
display: block;
7574
margin: 0 calc(-1 * var(--ifm-pre-padding));
7675
padding: 0 var(--ifm-pre-padding);
7776
border-left: 3px solid #ff000080;
7877
}
7978

80-
.code-block-diff-add-line{
79+
.code-block-diff-add-line {
8180
background-color: #00ff001f;
8281
display: block;
8382
margin: 0 calc(-1 * var(--ifm-pre-padding));
@@ -89,11 +88,13 @@
8988
.github-badges {
9089
text-align: start;
9190
}
91+
9292
/* Add some space between github badges */
9393
.github-badges>a {
9494
margin-left: 2px;
9595
margin-right: 2px;
9696
}
97+
9798
/* center the footer items' content */
9899
.footer__item {
99100
text-align: center;
@@ -113,6 +114,7 @@
113114
background-color: white !important;
114115
border-radius: var(--ifm-global-radius);
115116
}
117+
116118
/**
117119
* Disables the copy button on a code block if the language is
118120
* set to 'disable-copy-button'.
@@ -131,6 +133,7 @@
131133
margin: 0;
132134
line-height: normal;
133135
}
136+
134137
.has-tooltip:hover .tooltip {
135138
@apply visible z-50;
136139
}
@@ -150,6 +153,7 @@
150153
margin-bottom: 16px;
151154
border-left: 0.25em solid var(--github-alert-default-color);
152155
}
156+
153157
.markdown-alert-note .markdown-alert-title,
154158
.markdown-alert-note .markdown-alert-title>svg {
155159
color: var(--github-alert-note-color);
@@ -159,6 +163,7 @@
159163
.markdown-alert-note {
160164
border-left-color: var(--github-alert-note-color);
161165
}
166+
162167
.markdown-alert-important .markdown-alert-title,
163168
.markdown-alert-important .markdown-alert-title>svg {
164169
color: var(--github-alert-important-color);
@@ -168,6 +173,7 @@
168173
.markdown-alert-important {
169174
border-left-color: var(--github-alert-important-color);
170175
}
176+
171177
.markdown-alert-warning .markdown-alert-title,
172178
.markdown-alert-warning .markdown-alert-title>svg {
173179
color: var(--github-alert-warning-color);
@@ -202,19 +208,22 @@
202208
width: 100%;
203209
transition: all 0.2s cubic-bezier(0, 0, 0.2, 1);
204210
}
211+
205212
.yt-lite::after {
206213
content: "";
207214
display: block;
208215
padding-bottom: var(--aspect-ratio);
209216
}
210-
.yt-lite > iframe {
217+
218+
.yt-lite>iframe {
211219
width: 100%;
212220
height: 100%;
213221
position: absolute;
214222
top: 0;
215223
left: 0;
216224
}
217-
.yt-lite > .lty-playbtn {
225+
226+
.yt-lite>.lty-playbtn {
218227
width: 70px;
219228
height: 46px;
220229
background-color: #212121;
@@ -223,28 +232,33 @@
223232
border-radius: 14%;
224233
transition: all 0.2s cubic-bezier(0, 0, 0.2, 1);
225234
}
226-
.yt-lite:hover > .lty-playbtn {
235+
236+
.yt-lite:hover>.lty-playbtn {
227237
background-color: red;
228238
opacity: 1;
229239
}
230-
.yt-lite > .lty-playbtn::before {
240+
241+
.yt-lite>.lty-playbtn::before {
231242
content: "";
232243
border-color: transparent transparent transparent #fff;
233244
border-style: solid;
234245
border-width: 11px 0 11px 19px;
235246
}
236-
.yt-lite > .lty-playbtn,
237-
.yt-lite > .lty-playbtn::before {
247+
248+
.yt-lite>.lty-playbtn,
249+
.yt-lite>.lty-playbtn::before {
238250
position: absolute;
239251
top: 50%;
240252
left: 50%;
241253
transform: translate3d(-50%, -50%, 0);
242254
}
255+
243256
.yt-lite.lyt-activated {
244257
cursor: unset;
245258
}
259+
246260
.yt-lite.lyt-activated::before,
247-
.yt-lite.lyt-activated > .lty-playbtn {
261+
.yt-lite.lyt-activated>.lty-playbtn {
248262
opacity: 0;
249263
pointer-events: none;
250264
}
@@ -258,7 +272,53 @@
258272
margin: 0 auto;
259273
}
260274

261-
.yt-lite > .lty-playbtn {
275+
.yt-lite>.lty-playbtn {
262276
cursor: pointer;
263277
border: 0;
278+
}
279+
280+
/* Full width Redoc API viewer */
281+
.redocusaurus {
282+
max-width: none !important;
283+
width: 100% !important;
284+
}
285+
286+
.redocusaurus .api-content {
287+
max-width: none !important;
288+
}
289+
290+
.redoc-wrap {
291+
max-width: none !important;
292+
}
293+
294+
/* Expand main container for Redoc pages */
295+
article:has(.redocusaurus) {
296+
max-width: none !important;
297+
}
298+
299+
.docMainContainer_TBSr:has(.redocusaurus) {
300+
max-width: 100% !important;
301+
}
302+
303+
.container:has(.redocusaurus) {
304+
max-width: 100% !important;
305+
}
306+
307+
.docItemContainer_Djhp:has(.redocusaurus) {
308+
max-width: none !important;
309+
width: 100%;
310+
}
311+
312+
.docItemCol_VOVn:has(.redocusaurus) {
313+
max-width: none !important;
314+
flex-basis: 100% !important;
315+
}
316+
317+
/* Hide Redocly branding footer */
318+
.redocusaurus a[href*="redocly.com"] {
319+
display: none !important;
320+
}
321+
322+
.redocusaurus [class*="powered-by"] {
323+
display: none !important;
264324
}

0 commit comments

Comments
 (0)