Skip to content

Commit 78c7b5f

Browse files
authored
DOC-3471, DOC-3476: Output Markdown endpoints from LLM file generator and add Context7 MCP instructions (#4123)
Add toMarkdownEndpoints() to generate-llm-files.js so generated llms.txt and llms-full.txt URLs point to index.md Markdown endpoints instead of trailing-slash HTML pages. Add Context7 MCP setup section to the llms.txt template in the generator so it persists across regenerations. Regenerated both files from the production sitemap to validate.
1 parent 0a7454d commit 78c7b5f

3 files changed

Lines changed: 573 additions & 507 deletions

File tree

-scripts/generate-llm-files.js

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ const BASE_URL = 'https://www.tiny.cloud/docs/tinymce/latest';
1919
const DOCS_ROOT_URL = 'https://www.tiny.cloud/docs';
2020
const OUTPUT_DIR = path.join(__dirname, '../modules/ROOT/attachments');
2121

22+
// Convert a trailing-slash doc URL to its Markdown endpoint.
23+
// e.g. https://www.tiny.cloud/docs/tinymce/latest/basic-setup/
24+
// -> https://www.tiny.cloud/docs/tinymce/latest/basic-setup/index.md
25+
// Rewrite doc page URLs from trailing-slash to index.md Markdown endpoints.
26+
// Only affects URLs under /docs/tinymce/; CDN and file URLs are unchanged.
27+
function toMarkdownEndpoints(content) {
28+
return content.replace(
29+
/https:\/\/www\.tiny\.cloud\/docs\/tinymce\/[^\s)"]+/g,
30+
(match) => match.endsWith('/') ? match + 'index.md' : match
31+
);
32+
}
33+
2234
// Fetch sitemap from URL or file
2335
async function getSitemap(source) {
2436
if (source.startsWith('http://') || source.startsWith('https://')) {
@@ -1206,6 +1218,33 @@ TinyMCE AI (\`tinymceai\` plugin) is the current AI writing assistant for TinyMC
12061218
- [Upgrading TinyMCE](${BASE_URL}/upgrading/): Upgrade guide
12071219
- [Migration from 7.x](${BASE_URL}/migration-from-7x/): Migrate from TinyMCE 7
12081220
1221+
## AI-Assisted Development with MCP
1222+
1223+
For up-to-date TinyMCE documentation directly in AI coding tools, set up the Context7 MCP server. TinyMCE docs are indexed at [context7.com/tinymce/tinymce-docs](https://context7.com/tinymce/tinymce-docs).
1224+
1225+
### Cursor
1226+
1227+
Add to \`.cursor/mcp.json\`:
1228+
1229+
\`\`\`json
1230+
{
1231+
"mcpServers": {
1232+
"context7": {
1233+
"command": "npx",
1234+
"args": ["-y", "@upstash/context7-mcp"]
1235+
}
1236+
}
1237+
}
1238+
\`\`\`
1239+
1240+
### Claude Code
1241+
1242+
\`\`\`bash
1243+
claude mcp add context7 -- npx -y @upstash/context7-mcp
1244+
\`\`\`
1245+
1246+
Add "use context7" to any prompt for live TinyMCE documentation lookups.
1247+
12091248
## Complete Documentation
12101249
12111250
For a complete list of all ${urls.length} documentation pages, see [llms-full.txt](${DOCS_ROOT_URL}/llms-full.txt).
@@ -1225,11 +1264,11 @@ async function main() {
12251264
const urls = parseSitemap(sitemapContent);
12261265
console.log(`Found ${urls.length} unique URLs in sitemap`);
12271266

1228-
const llmsTxt = generateLLMsTxt(urls);
1267+
const llmsTxt = toMarkdownEndpoints(generateLLMsTxt(urls));
12291268
fs.writeFileSync(path.join(OUTPUT_DIR, 'llms.txt'), llmsTxt);
12301269
console.log('✓ Generated llms.txt');
12311270

1232-
const llmsFullTxt = await generateLLMsFullTxt(urls);
1271+
const llmsFullTxt = toMarkdownEndpoints(await generateLLMsFullTxt(urls));
12331272
fs.writeFileSync(path.join(OUTPUT_DIR, 'llms-full.txt'), llmsFullTxt);
12341273
console.log('✓ Generated llms-full.txt');
12351274

0 commit comments

Comments
 (0)