@apify/docs-theme 1.0.165 → 1.0.167
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 +1 -1
- package/src/markdown.js +27 -27
- package/src/roa-loader/index.js +3 -3
- package/src/theme/ColorModeToggle/index.jsx +6 -6
- package/src/theme/DocSidebarItem/Link/index.jsx +6 -6
- package/src/theme/Footer/index.jsx +3 -3
- package/src/theme/Layout/index.jsx +6 -6
- package/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.jsx +1 -1
- package/src/theme/NavbarItem/ComponentTypes.jsx +15 -16
- package/src/theme/RunnableCodeBlock/RunnableCodeBlock.jsx +4 -4
- package/src/theme/SearchBar/index.js +2 -1
- package/src/theme.js +0 -1
package/package.json
CHANGED
package/src/markdown.js
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
const remarkParse = require('remark-parse');
|
|
2
2
|
const remarkStringify = require('remark-stringify');
|
|
3
3
|
const { unified } = require('unified');
|
|
4
|
-
const { visitParents } = require('unist-util-visit-parents');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Updates the markdown content for better UX and compatibility with Docusaurus v3.
|
|
8
|
-
* @param {string} changelog The markdown content.
|
|
9
|
-
* @returns {string} The updated markdown content.
|
|
10
|
-
*/
|
|
11
|
-
function updateChangelog(changelog) {
|
|
12
|
-
const pipeline = unified()
|
|
13
|
-
.use(remarkParse)
|
|
14
|
-
.use(removeGitCliffMarkers)
|
|
15
|
-
.use(incrementHeadingLevels)
|
|
16
|
-
.use(prettifyPRLinks)
|
|
17
|
-
.use(linkifyUserTags)
|
|
18
|
-
.use(remarkStringify);
|
|
19
|
-
|
|
20
|
-
changelog = pipeline.processSync(changelog).toString();
|
|
21
|
-
changelog = addFrontmatter(changelog);
|
|
22
|
-
changelog = escapeMDXCharacters(changelog);
|
|
23
|
-
return changelog;
|
|
24
|
-
}
|
|
4
|
+
const { visitParents, CONTINUE } = require('unist-util-visit-parents');
|
|
25
5
|
|
|
26
6
|
/**
|
|
27
7
|
* Bumps the headings levels in the markdown content. This function increases the depth
|
|
@@ -60,7 +40,7 @@ const linkifyUserTags = () => (tree) => {
|
|
|
60
40
|
|
|
61
41
|
const directParent = parents[parents.length - 1];
|
|
62
42
|
|
|
63
|
-
if (!match || directParent.type === 'link') return;
|
|
43
|
+
if (!match || directParent.type === 'link') return CONTINUE;
|
|
64
44
|
|
|
65
45
|
const nodeIndexInParent = directParent.children.findIndex((x) => x === node);
|
|
66
46
|
|
|
@@ -77,10 +57,10 @@ const linkifyUserTags = () => (tree) => {
|
|
|
77
57
|
node.value = before;
|
|
78
58
|
directParent.children.splice(nodeIndexInParent + 1, 0, link);
|
|
79
59
|
|
|
80
|
-
if (!after) return nodeIndexInParent + 2;
|
|
60
|
+
if (!after) return [CONTINUE, nodeIndexInParent + 2];
|
|
81
61
|
|
|
82
62
|
directParent.children.splice(nodeIndexInParent + 2, 0, { type: 'text', value: `${ending}${after}` });
|
|
83
|
-
return nodeIndexInParent + 3;
|
|
63
|
+
return [CONTINUE, nodeIndexInParent + 3];
|
|
84
64
|
});
|
|
85
65
|
};
|
|
86
66
|
|
|
@@ -95,7 +75,7 @@ const prettifyPRLinks = () => (tree) => {
|
|
|
95
75
|
const prLinkRegex = /https:\/\/github.com\/[^\s]+\/pull\/(\d+)/g;
|
|
96
76
|
const match = prLinkRegex.exec(node.value);
|
|
97
77
|
|
|
98
|
-
if (!match) return;
|
|
78
|
+
if (!match) return CONTINUE;
|
|
99
79
|
|
|
100
80
|
const directParent = parents[parents.length - 1];
|
|
101
81
|
const nodeIndexInParent = directParent.children.findIndex((x) => x === node);
|
|
@@ -112,10 +92,10 @@ const prettifyPRLinks = () => (tree) => {
|
|
|
112
92
|
node.value = before;
|
|
113
93
|
|
|
114
94
|
directParent.children.splice(nodeIndexInParent + 1, 0, link);
|
|
115
|
-
if (!after) return nodeIndexInParent + 1;
|
|
95
|
+
if (!after) return [CONTINUE, nodeIndexInParent + 1];
|
|
116
96
|
|
|
117
97
|
directParent.children.splice(nodeIndexInParent + 2, 0, { type: 'text', value: after });
|
|
118
|
-
return nodeIndexInParent + 2;
|
|
98
|
+
return [CONTINUE, nodeIndexInParent + 2];
|
|
119
99
|
});
|
|
120
100
|
};
|
|
121
101
|
|
|
@@ -148,6 +128,26 @@ function escapeMDXCharacters(changelog) {
|
|
|
148
128
|
});
|
|
149
129
|
}
|
|
150
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Updates the markdown content for better UX and compatibility with Docusaurus v3.
|
|
133
|
+
* @param {string} changelog The markdown content.
|
|
134
|
+
* @returns {string} The updated markdown content.
|
|
135
|
+
*/
|
|
136
|
+
function updateChangelog(changelog) {
|
|
137
|
+
const pipeline = unified()
|
|
138
|
+
.use(remarkParse)
|
|
139
|
+
.use(removeGitCliffMarkers)
|
|
140
|
+
.use(incrementHeadingLevels)
|
|
141
|
+
.use(prettifyPRLinks)
|
|
142
|
+
.use(linkifyUserTags)
|
|
143
|
+
.use(remarkStringify);
|
|
144
|
+
|
|
145
|
+
changelog = pipeline.processSync(changelog).toString();
|
|
146
|
+
changelog = addFrontmatter(changelog);
|
|
147
|
+
changelog = escapeMDXCharacters(changelog);
|
|
148
|
+
return changelog;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
151
|
module.exports = {
|
|
152
152
|
updateChangelog,
|
|
153
153
|
};
|
package/src/roa-loader/index.js
CHANGED
|
@@ -38,13 +38,14 @@ async function getHash(source) {
|
|
|
38
38
|
})).json();
|
|
39
39
|
|
|
40
40
|
if (!res.data || !res.data.encoded) {
|
|
41
|
-
// eslint-disable-next-line no-console
|
|
42
41
|
console.error(`Signing failed:' ${inspect(res.error) || 'Unknown error'}`, res);
|
|
43
42
|
return 'invalid-token';
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
cache[cacheKey] = res.data.encoded;
|
|
47
|
-
await new Promise((resolve) =>
|
|
46
|
+
await new Promise((resolve) => {
|
|
47
|
+
setTimeout(resolve, 100);
|
|
48
|
+
});
|
|
48
49
|
|
|
49
50
|
return res.data.encoded;
|
|
50
51
|
}
|
|
@@ -79,7 +80,6 @@ module.exports = async function (code) {
|
|
|
79
80
|
return { code, hash: 'fast' };
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
// eslint-disable-next-line no-console
|
|
83
83
|
console.log(`Signing ${urlToRequest(this.resourcePath)}...`, { working, queue: queue.length });
|
|
84
84
|
const codeHash = await encodeAndSign(code);
|
|
85
85
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
5
1
|
import { translate } from '@docusaurus/Translate';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
8
6
|
import styles from './styles.module.css';
|
|
7
|
+
import IconDarkMode from '../Icon/DarkMode';
|
|
8
|
+
import IconLightMode from '../Icon/LightMode';
|
|
9
9
|
|
|
10
10
|
function ColorModeToggle({
|
|
11
11
|
className,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
1
|
+
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
2
|
+
import Link from '@docusaurus/Link';
|
|
3
|
+
import { isActiveSidebarItem } from '@docusaurus/plugin-content-docs/client';
|
|
4
4
|
import { ThemeClassNames } from '@docusaurus/theme-common';
|
|
5
5
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
6
|
-
import { isActiveSidebarItem } from '@docusaurus/plugin-content-docs/client';
|
|
7
|
-
import Link from '@docusaurus/Link';
|
|
8
|
-
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
9
6
|
import IconExternalLink from '@theme/Icon/ExternalLink';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
10
|
import styles from './styles.module.css';
|
|
11
11
|
|
|
12
12
|
export default function DocSidebarItemLink({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
import clsx from 'clsx';
|
|
4
1
|
import { useThemeConfig } from '@docusaurus/theme-common';
|
|
5
2
|
import LinkItem from '@theme/Footer/LinkItem';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
6
|
import styles from './index.module.css';
|
|
7
7
|
|
|
8
8
|
function FooterLinksColumn({ column }) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useLocation } from '@docusaurus/router';
|
|
2
2
|
// cannot use any of the theme aliases here as it causes a circular dependency :( ideas welcome
|
|
3
3
|
import Layout from '@docusaurus/theme-classic/lib/theme/Layout/index';
|
|
4
|
-
import { usePluginData } from '@docusaurus/useGlobalData';
|
|
5
4
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
6
|
-
import {
|
|
5
|
+
import { usePluginData } from '@docusaurus/useGlobalData';
|
|
6
|
+
import React from 'react';
|
|
7
7
|
|
|
8
8
|
export default function LayoutWrapper(props) {
|
|
9
9
|
const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
|
|
@@ -13,9 +13,9 @@ export default function LayoutWrapper(props) {
|
|
|
13
13
|
return (
|
|
14
14
|
<div style={{
|
|
15
15
|
'--ifm-navbar-height': subNavbar && !currentPath.startsWith('api/v2') ? '123px' : '68px',
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
margin: 0,
|
|
17
|
+
padding: 0,
|
|
18
|
+
boxSizing: 'border-box',
|
|
19
19
|
}}>
|
|
20
20
|
<Layout {...props} />
|
|
21
21
|
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { useThemeConfig } from '@docusaurus/theme-common';
|
|
3
2
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
4
3
|
import { usePluginData } from '@docusaurus/useGlobalData';
|
|
5
4
|
import NavbarItem from '@theme/NavbarItem';
|
|
5
|
+
import React from 'react';
|
|
6
6
|
|
|
7
7
|
function useNavbarItems() {
|
|
8
8
|
// TODO temporary casting until ThemeConfig type is improved
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { useDocsVersion, useLayoutDoc } from '@docusaurus/plugin-content-docs/client';
|
|
2
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
1
3
|
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
|
4
|
+
import DocSidebarNavbarItem from '@theme/NavbarItem/DocSidebarNavbarItem';
|
|
5
|
+
import DocsVersionDropdownNavbarItem from '@theme/NavbarItem/DocsVersionDropdownNavbarItem';
|
|
6
|
+
import DocsVersionNavbarItem from '@theme/NavbarItem/DocsVersionNavbarItem';
|
|
2
7
|
import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem';
|
|
8
|
+
import HtmlNavbarItem from '@theme/NavbarItem/HtmlNavbarItem';
|
|
3
9
|
import LocaleDropdownNavbarItem from '@theme/NavbarItem/LocaleDropdownNavbarItem';
|
|
4
10
|
import SearchNavbarItem from '@theme/NavbarItem/SearchNavbarItem';
|
|
5
|
-
import HtmlNavbarItem from '@theme/NavbarItem/HtmlNavbarItem';
|
|
6
|
-
import DocSidebarNavbarItem from '@theme/NavbarItem/DocSidebarNavbarItem';
|
|
7
|
-
import DocsVersionNavbarItem from '@theme/NavbarItem/DocsVersionNavbarItem';
|
|
8
|
-
import DocsVersionDropdownNavbarItem from '@theme/NavbarItem/DocsVersionDropdownNavbarItem';
|
|
9
|
-
import { useDocsVersion, useLayoutDoc } from '@docusaurus/plugin-content-docs/client';
|
|
10
|
-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
11
11
|
import React from 'react';
|
|
12
12
|
|
|
13
13
|
// const versions = require('../../../versions.json');
|
|
@@ -40,7 +40,6 @@ function ApiNavbarItem(ctx) {
|
|
|
40
40
|
let version = {};
|
|
41
41
|
|
|
42
42
|
try {
|
|
43
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
44
43
|
version = useDocsVersion();
|
|
45
44
|
} catch {
|
|
46
45
|
version.version = stable;
|
|
@@ -87,15 +86,15 @@ function ApiNavbarItem(ctx) {
|
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
const ComponentTypes = {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
default: DefaultNavbarItem,
|
|
90
|
+
localeDropdown: LocaleDropdownNavbarItem,
|
|
91
|
+
search: SearchNavbarItem,
|
|
92
|
+
dropdown: DropdownNavbarItem,
|
|
93
|
+
html: HtmlNavbarItem,
|
|
95
94
|
'custom-api': ApiNavbarItem,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
doc: DocNavbarItem,
|
|
96
|
+
docSidebar: DocSidebarNavbarItem,
|
|
97
|
+
docsVersion: DocsVersionNavbarItem,
|
|
98
|
+
docsVersionDropdown: DocsVersionDropdownNavbarItem,
|
|
100
99
|
};
|
|
101
100
|
export default ComponentTypes;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import CodeBlock from '@theme/CodeBlock';
|
|
5
1
|
import Link from '@docusaurus/Link';
|
|
2
|
+
import CodeBlock from '@theme/CodeBlock';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
6
|
import styles from './RunnableCodeBlock.module.css';
|
|
7
7
|
|
|
8
8
|
const EXAMPLE_RUNNERS = {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ApifySearch } from '@apify/docs-search-modal';
|
|
2
1
|
import BrowserOnly from '@docusaurus/BrowserOnly';
|
|
3
2
|
import RouterLink from '@docusaurus/Link';
|
|
4
3
|
import { useLocation, useHistory } from '@docusaurus/router';
|
|
5
4
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
6
5
|
import React, { useCallback } from 'react';
|
|
7
6
|
|
|
7
|
+
import { ApifySearch } from '@apify/docs-search-modal';
|
|
8
|
+
|
|
8
9
|
/**
|
|
9
10
|
* Tests whether the given href is pointing to the current docusaurus instance (so we can use the router link).
|
|
10
11
|
*/
|
package/src/theme.js
CHANGED
|
@@ -108,7 +108,6 @@ This either means that your Docusaurus setup is misconfigured, or that your GitH
|
|
|
108
108
|
await generateChangelogFromGitHubReleases(pathsToCopyChangelog, `${context.siteConfig.organizationName}/${context.siteConfig.projectName}`);
|
|
109
109
|
}
|
|
110
110
|
} catch (e) {
|
|
111
|
-
// eslint-disable-next-line no-console
|
|
112
111
|
console.warn(`Changelog page could not be initialized: ${e.message}`);
|
|
113
112
|
}
|
|
114
113
|
},
|