Skip to content

Commit 52a5458

Browse files
authored
docs: update @apify/docusaurus-plugin-typedoc-api (#713)
Updating the plugin allows us to use the new unified transformation pipeline instead of handling the API docs generation separately in each Python project. The new version also now renders the Typedoc objects in machine-readable elements on the page, so we can use the new `reexports` plugin option (more about that in a PR in `apify-sdk-python`).
1 parent fe29fd8 commit 52a5458

File tree

8 files changed

+236
-715
lines changed

8 files changed

+236
-715
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ build-api-reference:
4949
cd website && poetry run ./build_api_reference.sh
5050

5151
build-docs:
52-
cd website && corepack enable && yarn && yarn build
52+
cd website && corepack enable && yarn && poetry run yarn build
5353

5454
run-docs: build-api-reference
55-
cd website && corepack enable && yarn && yarn start
55+
cd website && corepack enable && yarn && poetry run yarn start

website/build_api_reference.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
#!/bin/bash
22

3-
# Create docspec dump of this package's source code through pydoc-markdown
4-
python ./pydoc-markdown/generate_ast.py > docspec-dump.jsonl
5-
6-
rm -rf "${apify_shared_tempdir}"
7-
83
# Generate import shortcuts from the modules
94
python generate_module_shortcuts.py
10-
11-
# Transform the docpec dumps into Typedoc-compatible docs tree
12-
node transformDocs.js

website/docusaurus.config.js

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
1-
/* eslint-disable global-require,import/no-extraneous-dependencies */
1+
/* eslint-disable global-require */
2+
const path = require('path');
3+
24
const { externalLinkProcessor } = require('./tools/utils/externalLink');
3-
const { groupSort } = require('./transformDocs');
5+
6+
const GROUP_ORDER = [
7+
'Classes',
8+
'Abstract classes',
9+
'Data structures',
10+
'Errors',
11+
'Functions',
12+
'Constructors',
13+
'Methods',
14+
'Properties',
15+
'Constants',
16+
'Enumeration Members',
17+
];
18+
19+
const groupSort = (g1, g2) => {
20+
if (GROUP_ORDER.includes(g1) && GROUP_ORDER.includes(g2)) {
21+
return GROUP_ORDER.indexOf(g1) - GROUP_ORDER.indexOf(g2);
22+
}
23+
return g1.localeCompare(g2);
24+
};
425

526
/** @type {Partial<import('@docusaurus/types').DocusaurusConfig>} */
627
module.exports = {
@@ -14,6 +35,7 @@ module.exports = {
1435
'/python/js/custom.js',
1536
'/crawlee-python/js/custom.js',
1637
],
38+
githubHost: 'github.com',
1739
headTags: [
1840
// Intercom messenger
1941
{
@@ -78,9 +100,11 @@ module.exports = {
78100
excludeExternals: false,
79101
},
80102
sortSidebar: groupSort,
81-
pathToCurrentVersionTypedocJSON: `${__dirname}/api-typedoc-generated.json`,
82103
routeBasePath: 'api',
83-
python: true,
104+
pythonOptions: {
105+
pythonModulePath: path.join(__dirname, '../src/crawlee'),
106+
moduleShortcutsPath: path.join(__dirname, 'module_shortcuts.json'),
107+
},
84108
},
85109
],
86110
// [

website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"typescript": "5.6.3"
3535
},
3636
"dependencies": {
37-
"@apify/docusaurus-plugin-typedoc-api": "^4.2.7",
37+
"@apify/docusaurus-plugin-typedoc-api": "^4.3.0",
3838
"@apify/utilities": "^2.8.0",
3939
"@docusaurus/core": "^3.5.2",
4040
"@docusaurus/mdx-loader": "^3.5.2",

website/parse_types.py

Lines changed: 0 additions & 82 deletions
This file was deleted.

website/pydoc-markdown.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)