File tree Expand file tree Collapse file tree 2 files changed +18
-20
lines changed
Expand file tree Collapse file tree 2 files changed +18
-20
lines changed Original file line number Diff line number Diff line change @@ -21,15 +21,10 @@ jobs:
2121 with :
2222 python-version : ' 3.x'
2323
24- - name : Install dependencies
25- run : |
26- python -m pip install --upgrade pip
27- pip install mkdocs mkdocs-material
28-
2924 - name : Update dir
3025 run : python ./update_dir.py
3126
3227 - name : Deploy docs to GitHub Pages
33- uses : mhausenblas /mkdocs-deploy-gh-pages@master
28+ uses : H-Sofie /mkdocs-deploy-with-material-theme@main
3429 env :
3530 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change @@ -78,20 +78,23 @@ def process_directory(base_dir: str, rel_path: str):
7878 # 是子目录
7979 subdirs .append (item )
8080
81- # 写出当前目录的 index.md
82- index_md_path = os .path .join (docs_folder , "index.md" )
83- with open (index_md_path , "w" , encoding = "utf-8" ) as wf :
84- # 1) 写 README 内容(若有)
85- if readme_content .strip ():
86- wf .write (readme_content .strip ())
87- wf .write ("\n \n ---\n \n " ) # 加点空行,避免直接跟标题混在一起
88-
89- # 2) 输出大标题“# 文件列表”
90- wf .write ("# 文件列表\n " )
91-
92- # 3) 列出当前目录内的文件链接
93- for fname , url in file_links :
94- wf .write (f"- [{ fname } ]({ url } )\n " )
81+ if not readme_content .strip () and not file_links :
82+ pass
83+ else :
84+ # 写出当前目录的 index.md
85+ index_md_path = os .path .join (docs_folder , "index.md" )
86+ with open (index_md_path , "w" , encoding = "utf-8" ) as wf :
87+ # 1) 写 README 内容(若有)
88+ if readme_content .strip ():
89+ wf .write (readme_content .strip ())
90+ wf .write ("\n \n ---\n \n " ) # 加点空行,避免直接跟标题混在一起
91+
92+ # 2) 输出大标题“# 文件列表”
93+ wf .write ("# 文件列表\n " )
94+
95+ # 3) 列出当前目录内的文件链接
96+ for fname , url in file_links :
97+ wf .write (f"- [{ fname } ]({ url } )\n " )
9598
9699 # 递归处理子目录
97100 for subdir in subdirs :
You can’t perform that action at this time.
0 commit comments