@apify/docs-theme 1.0.134 → 1.0.136

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/docs-theme",
3
- "version": "1.0.134",
3
+ "version": "1.0.136",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -19,7 +19,7 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@apify/docs-search-modal": "^1.1.0",
22
+ "@apify/docs-search-modal": "^1.1.1",
23
23
  "@docusaurus/theme-common": "^3.5.2",
24
24
  "@stackql/docusaurus-plugin-hubspot": "^1.1.0",
25
25
  "axios": "^1.7.4",
@@ -0,0 +1,41 @@
1
+ import Link from '@docusaurus/Link';
2
+ import clsx from 'clsx';
3
+ import React from 'react';
4
+
5
+ import styles from './styles.module.css';
6
+
7
+ // Recursive component rendering the toc tree
8
+ function TOCItemTree({
9
+ toc,
10
+ className,
11
+ linkClassName,
12
+ isChild,
13
+ }) {
14
+ if (!toc.length) {
15
+ return null;
16
+ }
17
+ return (
18
+ <ul className={isChild ? undefined : className}>
19
+ {toc.map((heading) => (
20
+ <li key={heading.id}>
21
+ <Link
22
+ to={`#${heading.id}`}
23
+ className={clsx(styles.apifyTocLink, linkClassName ?? undefined)}
24
+ data-label={heading.value}
25
+ // Developer provided the HTML, so assume it's safe.
26
+ dangerouslySetInnerHTML={{ __html: heading.value }}
27
+ />
28
+ <TOCItemTree
29
+ isChild
30
+ toc={heading.children}
31
+ className={className}
32
+ linkClassName={linkClassName}
33
+ />
34
+ </li>
35
+ ))}
36
+ </ul>
37
+ );
38
+ }
39
+
40
+ // Memo only the tree root is enough
41
+ export default React.memo(TOCItemTree);
@@ -0,0 +1,50 @@
1
+ import { useThemeConfig } from '@docusaurus/theme-common';
2
+ import {
3
+ useTOCHighlight,
4
+ useFilteredAndTreeifiedTOC,
5
+ } from '@docusaurus/theme-common/internal';
6
+ import TOCItemTree from '@theme/TOCItems/Tree';
7
+ import React, { useMemo } from 'react';
8
+
9
+ export default function TOCItems({
10
+ toc,
11
+ className = 'table-of-contents table-of-contents__left-border',
12
+ linkClassName = 'table-of-contents__link',
13
+ linkActiveClassName = undefined,
14
+ minHeadingLevel: minHeadingLevelOption,
15
+ maxHeadingLevel: maxHeadingLevelOption,
16
+ ...props
17
+ }) {
18
+ const themeConfig = useThemeConfig();
19
+
20
+ const minHeadingLevel = minHeadingLevelOption ?? themeConfig.tableOfContents.minHeadingLevel;
21
+ const maxHeadingLevel = maxHeadingLevelOption ?? themeConfig.tableOfContents.maxHeadingLevel;
22
+
23
+ const tocTree = useFilteredAndTreeifiedTOC({
24
+ toc,
25
+ minHeadingLevel,
26
+ maxHeadingLevel,
27
+ });
28
+
29
+ const tocHighlightConfig = useMemo(() => {
30
+ if (linkClassName && linkActiveClassName) {
31
+ return {
32
+ linkClassName,
33
+ linkActiveClassName,
34
+ minHeadingLevel,
35
+ maxHeadingLevel,
36
+ };
37
+ }
38
+ return undefined;
39
+ }, [linkClassName, linkActiveClassName, minHeadingLevel, maxHeadingLevel]);
40
+ useTOCHighlight(tocHighlightConfig);
41
+
42
+ return (
43
+ <TOCItemTree
44
+ toc={tocTree}
45
+ className={className}
46
+ linkClassName={linkClassName}
47
+ {...props}
48
+ />
49
+ );
50
+ }
@@ -0,0 +1,12 @@
1
+ .apifyTocLink {
2
+ display: block;
3
+ }
4
+
5
+ .apifyTocLink::before {
6
+ display: block;
7
+ content: attr(data-label);
8
+ font-weight: 700;
9
+ height: 0;
10
+ overflow: hidden;
11
+ visibility: hidden;
12
+ }
@@ -1549,6 +1549,7 @@ html[data-theme='dark'] .runnable-code-block svg .apify-logo {
1549
1549
  .prism-code.language-javascript .token-line::before,
1550
1550
  .prism-code.language-json .token-line::before,
1551
1551
  .prism-code.language-json5 .token-line::before,
1552
+ .prism-code.language-py .token-line::before,
1552
1553
  .prism-code.language-python .token-line::before,
1553
1554
  .prism-code.language-dockerfile .token-line::before,
1554
1555
  .prism-code.language-XML .token-line::before,