@apify/docs-theme 1.0.204 → 1.0.206
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useDoc } from '@docusaurus/plugin-content-docs/client';
|
|
2
|
+
import { useLocation } from '@docusaurus/router';
|
|
3
|
+
import { ThemeClassNames } from '@docusaurus/theme-common';
|
|
4
|
+
import Heading from '@theme/Heading';
|
|
5
|
+
import LLMButtons from '@theme/LLMButtons';
|
|
6
|
+
import MDXContent from '@theme/MDXContent';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
function useSyntheticTitle() {
|
|
11
|
+
const { metadata, frontMatter, contentTitle } = useDoc();
|
|
12
|
+
const shouldRender = !frontMatter.hide_title && typeof contentTitle === 'undefined';
|
|
13
|
+
|
|
14
|
+
if (!shouldRender) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return metadata.title;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* This component is also used in other Apify docs (clients, SDKs, CLI)
|
|
23
|
+
*/
|
|
24
|
+
export default function DocItemContent({ children }) {
|
|
25
|
+
const syntheticTitle = useSyntheticTitle();
|
|
26
|
+
const location = useLocation();
|
|
27
|
+
|
|
28
|
+
// Define the allowed paths that should show LLMButtons
|
|
29
|
+
// The logic is handled here, and also in docusaurus.config.js (see docusaurus-plugin-openapi-docs)
|
|
30
|
+
const allowedPaths = [
|
|
31
|
+
'/api/v2/getting-started',
|
|
32
|
+
'/api/v2/actors',
|
|
33
|
+
'/api/v2/actors-actor-versions',
|
|
34
|
+
'/api/v2/actors-actor-builds',
|
|
35
|
+
'/api/v2/actors-actor-runs',
|
|
36
|
+
'/api/v2/actors-webhook-collection',
|
|
37
|
+
'/api/v2/actor-builds',
|
|
38
|
+
'/api/v2/actor-runs',
|
|
39
|
+
'/api/v2/actor-tasks',
|
|
40
|
+
'/api/v2/storage-datasets',
|
|
41
|
+
'/api/v2/storage-key-value-stores',
|
|
42
|
+
'/api/v2/storage-request-queues',
|
|
43
|
+
'/api/v2/storage-request-queues-requests',
|
|
44
|
+
'/api/v2/storage-request-queues-requests-locks',
|
|
45
|
+
'/api/v2/webhooks-webhooks',
|
|
46
|
+
'/api/v2/webhooks-webhook-dispatches',
|
|
47
|
+
'/api/v2/schedules',
|
|
48
|
+
'/api/v2/store',
|
|
49
|
+
'/api/v2/logs',
|
|
50
|
+
'/api/v2/users',
|
|
51
|
+
'/api/client',
|
|
52
|
+
'/platform',
|
|
53
|
+
'/sdk',
|
|
54
|
+
'/cli',
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
// Define paths that should not show LLMButtons (e.g., changelog pages)
|
|
58
|
+
const disallowedPaths = [
|
|
59
|
+
'/changelog',
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
const shouldShowLLMButtons = allowedPaths.some((path) => location.pathname.startsWith(path))
|
|
63
|
+
&& !disallowedPaths.some((path) => location.pathname.includes(path));
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
|
|
67
|
+
{syntheticTitle && <Heading as="h1">{syntheticTitle}</Heading>}
|
|
68
|
+
{shouldShowLLMButtons && <LLMButtons />}
|
|
69
|
+
<MDXContent>{children}</MDXContent>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|