Skip to content

Commit 69ab779

Browse files
committed
feat: better openapi docs
1 parent a67546f commit 69ab779

File tree

123 files changed

+30704
-19248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+30704
-19248
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ yarn.lock
1717
tmp
1818
jsconfig.json
1919
types
20-
sources/api
21-
sources/typedefs
2220
.history
2321
.docusaurus
2422
tsconfig.tsbuildinfo
2523
.turbo
26-
apify-docs-theme/package-lock.json

apify-docs-theme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"dependencies": {
2222
"@apify/docs-search-modal": "^1.1.1",
23-
"@docusaurus/theme-common": "^3.5.2",
23+
"@docusaurus/theme-common": "3.6.2",
2424
"@stackql/docusaurus-plugin-hubspot": "^1.1.0",
2525
"axios": "^1.7.4",
2626
"babel-loader": "^9.1.3",

apify-docs-theme/src/theme/Layout/index.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ import React from 'react';
22
// cannot use any of the theme aliases here as it causes a circular dependency :( ideas welcome
33
import Layout from '@docusaurus/theme-classic/lib/theme/Layout/index';
44
import { usePluginData } from '@docusaurus/useGlobalData';
5+
import useBaseUrl from '@docusaurus/useBaseUrl';
6+
import { useLocation } from '@docusaurus/router';
57

68
export default function LayoutWrapper(props) {
79
const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
10+
const baseUrl = useBaseUrl('/');
11+
const currentPath = useLocation().pathname.replace(new RegExp(`^${baseUrl}`), '');
12+
813
return (
914
<div style={{
10-
'--ifm-navbar-height': subNavbar ? '123px' : '68px',
15+
'--ifm-navbar-height': subNavbar && !currentPath.startsWith('api/v2') ? '123px' : '68px',
1116
'margin': 0,
1217
'padding': 0,
1318
'boxSizing': 'border-box',

apify-docs-theme/src/theme/custom.css

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,3 +1619,59 @@ iframe[src*="youtube"] {
16191619
margin-top: -130px;
16201620
position: absolute;
16211621
}
1622+
1623+
.redocusaurus .openapi-clients-box {
1624+
display: block;
1625+
float: right;
1626+
padding-left: 6px;
1627+
}
1628+
1629+
.redocusaurus .openapi-clients-box-heading {
1630+
display: inline-block;
1631+
font-family: 'San Francisco', Helvetica, Arial, sans-serif;
1632+
color: #6C7590;
1633+
font-style: normal;
1634+
font-weight: 700;
1635+
font-size: 14px;
1636+
line-height: 20px;
1637+
text-transform: uppercase;
1638+
padding-bottom: 6px;
1639+
}
1640+
1641+
.redocusaurus .openapi-clients-box-icon {
1642+
display: block;
1643+
padding-bottom: 6px;
1644+
}
1645+
1646+
.theme-api-markdown .openapi-clients-box {
1647+
display: block;
1648+
float: right;
1649+
padding-left: 6px;
1650+
}
1651+
1652+
.theme-api-markdown .openapi-clients-box-heading {
1653+
display: inline-block;
1654+
font-family: 'San Francisco', Helvetica, Arial, sans-serif;
1655+
color: #6C7590;
1656+
font-style: normal;
1657+
font-weight: 700;
1658+
font-size: 14px;
1659+
line-height: 20px;
1660+
text-transform: uppercase;
1661+
padding-bottom: 6px;
1662+
}
1663+
1664+
.theme-api-markdown .openapi-clients-box-icon {
1665+
display: block;
1666+
padding-bottom: 6px;
1667+
margin: 0 !important;
1668+
}
1669+
1670+
.theme-api-markdown .openapi__method-endpoint-path,
1671+
.theme-api-markdown .openapi-security__summary-header {
1672+
margin-top: 0;
1673+
}
1674+
1675+
.theme-api-markdown .prism-code .token-line::before {
1676+
display: none !important;
1677+
}

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
2-
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
2+
presets: ['@docusaurus/babel/preset'],
33
plugins: ['babel-plugin-styled-components'],
44
};

docusaurus.config.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ module.exports = {
8686
},
8787
}),
8888
],
89+
'docusaurus-theme-openapi-docs',
8990
'@docusaurus/theme-mermaid',
9091
],
9192
presets: /** @type {import('@docusaurus/types').PresetConfig[]} */ ([
9293
[
93-
'@docusaurus/preset-classic',
94+
'classic',
9495
/** @type {import('@docusaurus/preset-classic').Options} */
9596
({
9697
docs: {
@@ -158,6 +159,37 @@ module.exports = {
158159
sidebarPath: require.resolve('./sources/legal/sidebars.js'),
159160
},
160161
],
162+
[
163+
'@docusaurus/plugin-content-docs',
164+
{
165+
id: 'openapi',
166+
path: './sources/api',
167+
routeBasePath: 'api/v2-new',
168+
rehypePlugins: [externalLinkProcessor],
169+
showLastUpdateAuthor: false,
170+
showLastUpdateTime: false,
171+
breadcrumbs: false,
172+
sidebarPath: require.resolve('./sources/api/sidebars.js'),
173+
docItemComponent: '@theme/ApiItem', // Derived from docusaurus-theme-openapi
174+
},
175+
],
176+
[
177+
'docusaurus-plugin-openapi-docs',
178+
{
179+
id: 'openapi', // plugin id
180+
docsPluginId: 'openapi', // configured for preset-classic
181+
config: {
182+
/** @type {import('docusaurus-plugin-openapi-docs').Options} */
183+
v2: {
184+
specPath: 'node_modules/@apify/openapi/openapi.yaml',
185+
outputDir: './sources/api',
186+
sidebarOptions: {
187+
groupPathsBy: 'tag',
188+
},
189+
},
190+
},
191+
},
192+
],
161193
() => ({
162194
name: 'webpack-loader-fix',
163195
configureWebpack() {

0 commit comments

Comments
 (0)