Skip to content

Commit 90c462f

Browse files
Comment api md processing
1 parent 696fd49 commit 90c462f

File tree

3 files changed

+23
-41
lines changed

3 files changed

+23
-41
lines changed

apify-docs-theme/src/theme/Layout/index.jsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@ export default function LayoutWrapper(props) {
1010
const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
1111
const baseUrl = useBaseUrl('/');
1212
const currentPath = useLocation().pathname.replace(new RegExp(`^${baseUrl}`), '');
13-
const isMarkdownView = currentPath.endsWith('.md');
14-
15-
// Add data attribute to HTML element when on markdown view
16-
React.useEffect(() => {
17-
if (typeof document !== 'undefined') {
18-
const htmlElement = document.documentElement;
19-
if (isMarkdownView) {
20-
htmlElement.setAttribute('data-markdown-view', 'true');
21-
} else {
22-
htmlElement.removeAttribute('data-markdown-view');
23-
}
24-
}
25-
}, [isMarkdownView]);
2613

2714
return (
2815
<>

docusaurus.config.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -196,37 +196,37 @@ module.exports = {
196196
md = md.replace('--&gt;', '-->');
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-
}
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+
// }
209209

210-
// Find the first Heading h1 and add LLMButtons after it
211-
// eslint-disable-next-line max-len
212-
const headingRegex = /(<Heading[^>]*as=\{"h1"\}[^>]*className=\{"openapi__heading"\}[^>]*children=\{[^}]*\}[^>]*>\s*<\/Heading>)/;
213-
md = md.replace(headingRegex, '$1\n\n<LLMButtons />\n');
210+
// // Find the first Heading h1 and add LLMButtons after it
211+
// // eslint-disable-next-line max-len
212+
// const headingRegex = /(<Heading[^>]*as=\{"h1"\}[^>]*className=\{"openapi__heading"\}[^>]*children=\{[^}]*\}[^>]*>\s*<\/Heading>)/;
213+
// md = md.replace(headingRegex, '$1\n\n<LLMButtons />\n');
214214

215215
return md;
216216
},
217217
createInfoPageMD: (pageData) => {
218218
let md = createInfoPageMD(pageData);
219219

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-
}
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+
// }
225225

226-
// Find the first Heading h1 and add LLMButtons after it
227-
// eslint-disable-next-line max-len
228-
const headingRegex = /(<Heading[^>]*as=\{"h1"\}[^>]*className=\{"openapi__heading"\}[^>]*children=\{[^}]*\}[^>]*>\s*<\/Heading>)/;
229-
md = md.replace(headingRegex, '$1\n\n<LLMButtons />\n');
226+
// // Find the first Heading h1 and add LLMButtons after it
227+
// // eslint-disable-next-line max-len
228+
// const headingRegex = /(<Heading[^>]*as=\{"h1"\}[^>]*className=\{"openapi__heading"\}[^>]*children=\{[^}]*\}[^>]*>\s*<\/Heading>)/;
229+
// md = md.replace(headingRegex, '$1\n\n<LLMButtons />\n');
230230

231231
return md;
232232
},

src/components/LLMButtons/styles.module.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
margin-bottom: calc(var(--ifm-h1-vertical-rhythm-bottom) * var(--ifm-leading));
77
}
88

9-
/* Hide LLMButtons on markdown pages (URLs ending with .md) */
10-
html[data-markdown-view="true"] .llmButtonsContainer {
11-
display: none !important;
12-
}
13-
149
.llmButtonsSeparator {
1510
width: 1px;
1611
height: 16px;

0 commit comments

Comments
 (0)