Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,26 @@ repos:
language: system
entry: bash
pass_filenames: false
- id: check-markdown-filename
name: Check Markdown filenames for underscores
language: system
entry: bash
files: '\.md$'
stages:
- pre-commit
args:
- -c
- |
for file in "$@"; do
filename=$(basename "$file")
if [[ "$filename" =~ ^_ ]]; then
continue
fi
Comment on lines +125 to +127
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script skips files that start with an underscore (if [[ "$filename" =~ ^_ ]]; then continue; fi), but it's not clear why this exception exists. Consider adding a comment explaining why files starting with underscores are allowed, especially since the hook's purpose is to enforce hyphen usage instead of underscores.

if [[ "$filename" =~ _ ]]; then
echo "Error: Markdown file contains underscore: $file"
echo "Please rename to use hyphens (-) instead of underscores (_)"
echo "Example: file_name.md -> file-name.md"
exit 1
fi
done
- --
1 change: 1 addition & 0 deletions .windsurf/workflows/standardize-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ description: 标准化和验证中文文档路径、文件名及链接
- **入口文件**:每个目录应使用 `README.md`(不是 `index.md`)
- **安装目录**:统一使用 `install-system`(不是 `install-os`)
- **嵌套深度**:避免超过 2-3 层目录
- **结构规范**:`download.md` 应该位于一级目录(即和产品的 README 同级)且权重应该为 99(最后一项)

**检查项**:

Expand Down