feat: comprehensive documentation and demo updates

- Update READMEs and docs across multiple languages
- Enhance interactive demos for Agent, LLM, VLM, Audio, Image Gen, Terminal, and Web Basics
- Add new appendix sections for Database and IDE intros
- Update VitePress config, theme, and utility scripts
- Clean up unused assets and components
This commit is contained in:
sanbuphy
2026-01-16 19:10:21 +08:00
parent c8567ce23f
commit 73f4788d7e
150 changed files with 19530 additions and 13401 deletions
+33 -30
View File
@@ -1,9 +1,9 @@
const fs = require('fs');
const path = require('path');
const fs = require('fs')
const path = require('path')
const rootDir = process.cwd();
const docsReadmeDir = path.join(rootDir, 'docs-readme');
const rootReadmePath = path.join(rootDir, 'README.md');
const rootDir = process.cwd()
const docsReadmeDir = path.join(rootDir, 'docs-readme')
const rootReadmePath = path.join(rootDir, 'README.md')
const locales = [
{ code: 'zh-CN', name: '简体中文' },
@@ -19,38 +19,41 @@ const locales = [
{ code: 'vi-VN', name: 'Tiếng_Việt' },
{ code: 'de-DE', name: 'Deutsch' },
{ code: 'bn-BD', name: 'বাংলা' }
];
]
function generateNavBlock(isRoot) {
const links = locales.map(locale => {
const href = isRoot ? `docs-readme/${locale.code}/README.md` : `../${locale.code}/README.md`;
return ` <a href="${href}"><img alt="${locale.name}" src="https://img.shields.io/badge/${locale.name}-d9d9d9"></a>`;
});
return `<p align="center">\n${links.join('\n')}\n</p>`;
const links = locales.map((locale) => {
const href = isRoot
? `docs-readme/${locale.code}/README.md`
: `../${locale.code}/README.md`
return ` <a href="${href}"><img alt="${locale.name}" src="https://img.shields.io/badge/${locale.name}-d9d9d9"></a>`
})
return `<p align="center">\n${links.join('\n')}\n</p>`
}
function updateFile(filePath, isRoot) {
if (!fs.existsSync(filePath)) {
console.log(`File not found: ${filePath}`);
return;
console.log(`File not found: ${filePath}`)
return
}
let content = fs.readFileSync(filePath, 'utf8');
const newNavBlock = generateNavBlock(isRoot);
let content = fs.readFileSync(filePath, 'utf8')
const newNavBlock = generateNavBlock(isRoot)
// Regex to match the existing nav block. It starts with <p align="center"> and contains the badges.
// The badges in previous versions had slightly different names/links, but they all were inside <p align="center"> ... </p>
// We look for the block containing "简体中文" or "English" to be sure it's the language nav.
const regex = /<p align="center">\s*<a href=".*README.*\.md"><img alt=".*".*>\s*<\/a>[\s\S]*?<\/p>/;
const regex =
/<p align="center">\s*<a href=".*README.*\.md"><img alt=".*".*>\s*<\/a>[\s\S]*?<\/p>/
if (regex.test(content)) {
content = content.replace(regex, newNavBlock);
fs.writeFileSync(filePath, content, 'utf8');
console.log(`Updated ${filePath}`);
content = content.replace(regex, newNavBlock)
fs.writeFileSync(filePath, content, 'utf8')
console.log(`Updated ${filePath}`)
} else {
console.log(`Nav block not found in ${filePath}`);
console.log(`Nav block not found in ${filePath}`)
// Fallback: try to find where it should be (after the main title block?)
// In previous steps, we saw it's after the main title block div end or inside it.
// Let's try to match a simpler pattern if the complex one fails, or manual inspection might be needed.
@@ -59,10 +62,10 @@ function updateFile(filePath, isRoot) {
}
// Update root README
updateFile(rootReadmePath, true);
updateFile(rootReadmePath, true)
// Update docs-readme files
locales.forEach(locale => {
const filePath = path.join(docsReadmeDir, locale.code, 'README.md');
updateFile(filePath, false);
});
locales.forEach((locale) => {
const filePath = path.join(docsReadmeDir, locale.code, 'README.md')
updateFile(filePath, false)
})