Skip to content

Commit f702a9f

Browse files
Simplify imports of LLMButtons
1 parent 3cd84ff commit f702a9f

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import MDXImg from '@theme/MDXComponents/Img';
88
import MDXPre from '@theme/MDXComponents/Pre';
99
import MDXUl from '@theme/MDXComponents/Ul';
1010
import Mermaid from '@theme/Mermaid';
11+
import LLMButtons from '@site/src/components/LLMButtons';
1112
import React from 'react';
1213

1314
import RunnableCodeBlock from '../RunnableCodeBlock/RunnableCodeBlock';
@@ -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>)/;

0 commit comments

Comments
 (0)