|
1 | 1 | const { join, resolve } = require('node:path');
|
2 | 2 |
|
3 | 3 | const clsx = require('clsx');
|
4 |
| -const { createApiPageMD } = require('docusaurus-plugin-openapi-docs/lib/markdown'); |
| 4 | +const { createApiPageMD, createInfoPageMD } = require('docusaurus-plugin-openapi-docs/lib/markdown'); |
5 | 5 |
|
6 | 6 | const { config } = require('./apify-docs-theme');
|
7 | 7 | const { collectSlugs } = require('./tools/utils/collectSlugs');
|
8 | 8 | const { externalLinkProcessor } = require('./tools/utils/externalLink');
|
| 9 | +const { removeLlmButtons } = require('./tools/utils/removeLlmButtons'); |
9 | 10 |
|
10 | 11 | /** @type {Partial<import('@docusaurus/types').DocusaurusConfig>} */
|
11 | 12 | module.exports = {
|
@@ -196,6 +197,21 @@ module.exports = {
|
196 | 197 | md = md.replace('-->', '-->');
|
197 | 198 | }
|
198 | 199 |
|
| 200 | + // Find the first Heading h1 and add LLMButtons after it |
| 201 | + // eslint-disable-next-line max-len |
| 202 | + const headingRegex = /(<Heading[^>]*as=\{"h1"\}[^>]*className=\{"openapi__heading"\}[^>]*children=\{[^}]*\}[^>]*>\s*<\/Heading>)/; |
| 203 | + md = md.replace(headingRegex, '$1\n\n<LLMButtons />\n'); |
| 204 | + |
| 205 | + return md; |
| 206 | + }, |
| 207 | + createInfoPageMD: (pageData) => { |
| 208 | + let md = createInfoPageMD(pageData); |
| 209 | + |
| 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'); |
| 214 | + |
199 | 215 | return md;
|
200 | 216 | },
|
201 | 217 | },
|
@@ -293,6 +309,8 @@ module.exports = {
|
293 | 309 | categoryName: 'Platform documentation',
|
294 | 310 | },
|
295 | 311 | ],
|
| 312 | + // Add custom remark processing to remove LLM button text |
| 313 | + remarkPlugins: [removeLlmButtons], |
296 | 314 | },
|
297 | 315 | },
|
298 | 316 | ],
|
|
0 commit comments