@@ -196,37 +196,37 @@ 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 ( / ^ i m p o r t \s + .* ?f r o m \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 = / ( < H e a d i n g [ ^ > ] * a s = \{ " h 1 " \} [ ^ > ] * c l a s s N a m e = \{ " o p e n a p i _ _ h e a d i n g " \} [ ^ > ] * c h i l d r e n = \{ [ ^ } ] * \} [ ^ > ] * > \s * < \/ H e a d i n g > ) / ;
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 = / ( < H e a d i n g [ ^ > ] * a s = \{ " h 1 " \} [ ^ > ] * c l a s s N a m e = \{ " o p e n a p i _ _ h e a d i n g " \} [ ^ > ] * c h i l d r e n = \{ [ ^ } ] * \} [ ^ > ] * > \s * < \/ H e a d i n g > ) / ;
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 } ,
0 commit comments