Skip to content

Commit f162354

Browse files
Fix lint errors
Fix issues with content template
1 parent 84fcb58 commit f162354

File tree

4 files changed

+7
-24
lines changed

4 files changed

+7
-24
lines changed

apify-docs-theme/src/theme/MDXComponents/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import LLMButtons from '@site/src/components/LLMButtons';
12
import Admonition from '@theme/Admonition';
23
import MDXA from '@theme/MDXComponents/A';
34
import MDXCode from '@theme/MDXComponents/Code';
@@ -29,5 +30,6 @@ const MDXComponents = {
2930
admonition: Admonition,
3031
mermaid: Mermaid,
3132
RunnableCodeBlock,
33+
LLMButtons,
3234
};
3335
export default MDXComponents;

docusaurus.config.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,6 @@ module.exports = {
196196
md = md.replace('-->', '-->');
197197
}
198198

199-
// Add LLMButtons import and component
200-
if (!md.includes('import LLMButtons')) {
201-
// Find the first import statement and add LLMButtons import after it
202-
const firstImportMatch = md.match(/^import\s+.*?from\s+["'][^"']*["'];?\s*$/m);
203-
if (firstImportMatch) {
204-
const importEnd = md.indexOf(firstImportMatch[0]) + firstImportMatch[0].length;
205-
const llmButtonsImport = '\nimport LLMButtons from "@site/src/components/LLMButtons";';
206-
md = md.slice(0, importEnd) + llmButtonsImport + md.slice(importEnd);
207-
}
208-
}
209-
210199
// Find the first Heading h1 and add LLMButtons after it
211200
// eslint-disable-next-line max-len
212201
const headingRegex = /(<Heading[^>]*as=\{"h1"\}[^>]*className=\{"openapi__heading"\}[^>]*children=\{[^}]*\}[^>]*>\s*<\/Heading>)/;
@@ -217,12 +206,6 @@ module.exports = {
217206
createInfoPageMD: (pageData) => {
218207
let md = createInfoPageMD(pageData);
219208

220-
// Add LLMButtons import and component
221-
if (!md.includes('import LLMButtons')) {
222-
// eslint-disable-next-line max-len
223-
md = md.replace('import Heading from "@theme/Heading";', 'import Heading from "@theme/Heading";\nimport LLMButtons from "@site/src/components/LLMButtons";');
224-
}
225-
226209
// Find the first Heading h1 and add LLMButtons after it
227210
// eslint-disable-next-line max-len
228211
const headingRegex = /(<Heading[^>]*as=\{"h1"\}[^>]*className=\{"openapi__heading"\}[^>]*children=\{[^}]*\}[^>]*>\s*<\/Heading>)/;

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/theme/DocItem/Content/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,13 @@ export default function DocItemContent({ children }) {
4949
'/platform',
5050
];
5151

52-
const shouldShowLLMButtons = allowedPaths.some((path) => location.pathname.startsWith(path) && !location.pathname.endsWith('.md'));
52+
const shouldShowLLMButtons = allowedPaths.some((path) => location.pathname.startsWith(path));
5353

5454
return (
5555
<div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
56-
<header>
57-
{syntheticTitle && <Heading as="h1">{syntheticTitle}</Heading>}
58-
{shouldShowLLMButtons && <LLMButtons />}
59-
<MDXContent>{children}</MDXContent>
60-
</header>
56+
{syntheticTitle && <Heading as="h1">{syntheticTitle}</Heading>}
57+
{shouldShowLLMButtons && <LLMButtons />}
58+
<MDXContent>{children}</MDXContent>
6159
</div>
6260
);
6361
}

0 commit comments

Comments
 (0)