Skip to content

Commit e68eac3

Browse files
docs: Add copy for LLMs and view as markdown buttons
1 parent 9a7f8c5 commit e68eac3

File tree

15 files changed

+209
-15
lines changed

15 files changed

+209
-15
lines changed

sources/legal/index.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ slug: /
77
hide_table_of_contents: true
88
---
99

10-
# Apify Legal
1110
<!-- vale off -->
1211

1312
## Company details (Impressum)

sources/platform/actors/running/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ sidebar_position: 7.1
55
slug: /actors/running
66
---
77

8-
# Running Actors
9-
108
**In this section, you learn how to run Apify Actors using Apify Console or programmatically. You will learn about their configuration, versioning, data retention, usage, and pricing.**
119

1210
import Tabs from '@theme/Tabs';

sources/platform/index.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
---
2-
title: Home
2+
title: Apify platform
33
description: Apify is your one-stop shop for web scraping, data extraction, and RPA. Automate anything you can do manually in a browser.
44
slug: /
55
hide_table_of_contents: true
66
sidebar_position: 0
7+
sidebar_label: Home
78
---
89
import Card from "@site/src/components/Card";
910
import CardGrid from "@site/src/components/CardGrid";
1011
import homepageContent from "./homepage_content.json";
1112

12-
# Apify platform
13-
1413
> **Apify** is a cloud platform that helps you build reliable web scrapers, fast, and automate anything you can do manually in a web browser.
1514
>
1615
> **Actors** are serverless cloud programs running on the Apify platform that can easily crawl websites with millions of pages, but also perform arbitrary computing jobs such as sending emails or data transformations. They can be started manually, using our API or scheduler, and they can be easily integrated with other apps.

sources/platform/proxy/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import TabItem from '@theme/TabItem';
1111
import Card from "@site/src/components/Card";
1212
import CardGrid from "@site/src/components/CardGrid";
1313

14-
# Proxy
15-
1614
**Learn to anonymously access websites in scraping/automation jobs. Improve data outputs and efficiency of bots, and access websites from various geographies.**
1715

1816
---

sources/platform/security.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ category: platform
66
slug: /security
77
---
88

9-
# Security
10-
119
**Learn more about Apify's security practices and data protection measures that are used to protect your Actors, their data, and the Apify platform in general.**
1210

1311
---

sources/platform/storage/dataset.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ toc_max_heading_level: 4
66
slug: /storage/dataset
77
---
88

9-
# Dataset
10-
119
**Store and export web scraping, crawling or data processing job results. Learn how to access and manage datasets in Apify Console or via API.**
1210

1311
import Tabs from '@theme/Tabs';

sources/platform/storage/key_value_store.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ sidebar_position: 9.3
66
slug: /storage/key-value-store
77
---
88

9-
# Key-value store
10-
119
**Store anything from Actor or task run results, JSON documents, or images. Learn how to access and manage key-value stores from Apify Console or via API.**
1210

1311
import Tabs from '@theme/Tabs';
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import useBaseUrl from '@docusaurus/useBaseUrl';
2+
import React, { useState } from 'react';
3+
4+
import styles from '../styles.module.css';
5+
6+
// Custom component for button text
7+
function ButtonText({ isLoading, isCopied }: { isLoading: boolean; isCopied: boolean }) {
8+
if (isLoading) {
9+
return <>Copying...</>;
10+
}
11+
if (isCopied) {
12+
return <>Copied!</>;
13+
}
14+
return <>Copy for LLM</>;
15+
}
16+
17+
export default function CopyForLLM() {
18+
const copyIcon = useBaseUrl('/img/copy.svg');
19+
const [isLoading, setIsLoading] = useState(false);
20+
const [isCopied, setIsCopied] = useState(false);
21+
22+
const handleCopy = async () => {
23+
try {
24+
setIsLoading(true);
25+
26+
const currentUrl = window.location.href;
27+
const markdownUrl = `${currentUrl}.md`;
28+
29+
// Fetch the markdown content
30+
const response = await fetch(markdownUrl);
31+
32+
if (!response.ok) {
33+
throw new Error(`Failed to fetch markdown: ${response.status}`);
34+
}
35+
36+
const markdownContent = await response.text();
37+
38+
// Copy to clipboard
39+
await navigator.clipboard.writeText(markdownContent);
40+
41+
// Show success feedback
42+
setIsCopied(true);
43+
setTimeout(() => setIsCopied(false), 2000);
44+
} catch (error) {
45+
console.error('Failed to copy markdown content:', error);
46+
} finally {
47+
setIsLoading(false);
48+
}
49+
};
50+
51+
return (
52+
<button
53+
className={styles.llmButton}
54+
title="Copy for LLM"
55+
onClick={handleCopy}
56+
disabled={isLoading}
57+
>
58+
<span
59+
className={styles.llmButtonIcon}
60+
style={{
61+
backgroundImage: `url(${copyIcon})`,
62+
backgroundSize: 'contain',
63+
backgroundRepeat: 'no-repeat',
64+
backgroundPosition: 'center',
65+
display: 'inline-block',
66+
}}
67+
aria-label="Copy for LLM"
68+
/>
69+
<ButtonText isLoading={isLoading} isCopied={isCopied} />
70+
</button>
71+
);
72+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import useBaseUrl from '@docusaurus/useBaseUrl';
2+
import React from 'react';
3+
4+
import styles from '../styles.module.css';
5+
6+
export default function ViewAsMarkdown() {
7+
const markdownIcon = useBaseUrl('/img/markdown.svg');
8+
9+
const handleClick = () => {
10+
try {
11+
const currentUrl = window.location.href;
12+
const markdownUrl = `${currentUrl}.md`;
13+
window.open(markdownUrl, '_blank');
14+
} catch (error) {
15+
console.error('Error opening markdown file:', error);
16+
}
17+
};
18+
19+
return (
20+
<button
21+
className={styles.llmButton}
22+
title="View as Markdown"
23+
onClick={handleClick}
24+
>
25+
<span
26+
className={styles.llmButtonIcon}
27+
style={{
28+
backgroundImage: `url(${markdownIcon})`,
29+
backgroundSize: 'contain',
30+
backgroundRepeat: 'no-repeat',
31+
backgroundPosition: 'center',
32+
display: 'inline-block',
33+
}}
34+
aria-label="View as Markdown"
35+
/>
36+
View as Markdown
37+
</button>
38+
);
39+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
3+
import CopyForLLM from './CopyForLLM';
4+
import styles from './styles.module.css';
5+
import ViewAsMarkdown from './ViewAsMarkdown';
6+
7+
export default function LLMButtons() {
8+
return (
9+
<div className={styles.llmButtonsContainer}>
10+
<CopyForLLM />
11+
<div className={styles.llmButtonsSeparator}></div>
12+
<ViewAsMarkdown />
13+
</div>
14+
);
15+
}

0 commit comments

Comments
 (0)