update-markdown-file-index
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUpdate Markdown File Index
更新Markdown文件索引
Update markdown file with an index/table of files from folder .
${file}${input:folder}用指定文件夹中的文件索引/表格更新Markdown文件。
${input:folder}${file}Process
流程
- Scan: Read the target markdown file to understand existing structure
${file} - Discover: List all files in the specified folder matching pattern
${input:folder}${input:pattern} - Analyze: Identify if an existing table/index section exists to update, or create new structure
- Structure: Generate appropriate table/list format based on file types and existing content
- Update: Replace existing section or add new section with file index
- Validate: Ensure markdown syntax is valid and formatting is consistent
- 扫描:读取目标Markdown文件,了解现有结构
${file} - 发现:列出指定文件夹中符合模式
${input:folder}的所有文件${input:pattern} - 分析:判断是否存在需要更新的现有表格/索引章节,或者是否需要创建新结构
- 构建结构:根据文件类型和现有内容生成合适的表格/列表格式
- 更新:替换现有章节或添加包含文件索引的新章节
- 验证:确保Markdown语法有效且格式一致
File Analysis
文件分析
For each discovered file, extract:
- Name: Filename with or without extension based on context
- Type: File extension and category (e.g., ,
.md,.js).py - Description: First line comment, header, or inferred purpose
- Size: File size for reference (optional)
- Modified: Last modified date (optional)
对于每个发现的文件,提取以下信息:
- 名称:根据上下文决定是否包含扩展名的文件名
- 类型:文件扩展名及类别(例如、
.md、.js).py - 描述:第一行注释、标题或推断的用途
- 大小:供参考的文件大小(可选)
- 修改时间:最后修改日期(可选)
Table Structure Options
表格结构选项
Choose format based on file types and existing content:
根据文件类型和现有内容选择格式:
Option 1: Simple List
选项1:简单列表
markdown
undefinedmarkdown
undefinedFiles in ${folder}
Files in ${folder}
- filename.ext - Description
- filename2.ext - Description
undefined- filename.ext - Description
- filename2.ext - Description
undefinedOption 2: Detailed Table
选项2:详细表格
| File | Type | Description |
|---|---|---|
| filename.ext | Extension | Description |
| filename2.ext | Extension | Description |
| File | Type | Description |
|---|---|---|
| filename.ext | Extension | Description |
| filename2.ext | Extension | Description |
Option 3: Categorized Sections
选项3:分类章节
Group files by type/category with separate sections or sub-tables.
按类型/类别对文件进行分组,使用独立章节或子表格。
Update Strategy
更新策略
- 🔄 Update existing: If table/index section exists, replace content while preserving structure
- ➕ Add new: If no existing section, create new section using best-fit format
- 📋 Preserve: Maintain existing markdown formatting, heading levels, and document flow
- 🔗 Links: Use relative paths for file links within the repository
- 🔄 更新现有内容:如果存在表格/索引章节,替换内容同时保留结构
- ➕ 添加新内容:如果没有现有章节,使用最适合的格式创建新章节
- 📋 保留原有内容:维持现有Markdown格式、标题层级和文档流程
- 🔗 链接:在仓库内使用相对路径作为文件链接
Section Identification
章节识别
Look for existing sections with these patterns:
- Headings containing: "index", "files", "contents", "directory", "list"
- Tables with file-related columns
- Lists with file links
- HTML comments marking file index sections
查找包含以下模式的现有章节:
- 包含“index”、“files”、“contents”、“directory”、“list”的标题
- 包含文件相关列的表格
- 包含文件链接的列表
- 标记文件索引章节的HTML注释
Requirements
要求
- Preserve existing markdown structure and formatting
- Use relative paths for file links
- Include file descriptions when available
- Sort files alphabetically by default
- Handle special characters in filenames
- Validate all generated markdown syntax
- 保留现有Markdown结构和格式
- 使用相对路径作为文件链接
- 尽可能包含文件描述
- 默认按字母顺序对文件排序
- 处理文件名中的特殊字符
- 验证所有生成的Markdown语法