We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2323bef commit 0aac48aCopy full SHA for 0aac48a
bin/clean_toc.sh
@@ -1,13 +1,15 @@
1
#!/bin/bash
2
3
-POST_DIR=$(dirname "$(dirname "$(realpath "$0")")")/_posts
4
-echo $POST_DIR
5
-
6
-# 检测一个文件夹下所有的md格式的文件
7
-for file in $POST_DIR/*.md; do
8
- # 检查文件第一行是否包含 [toc]
9
- if [[ $(head -n 1 "$file") == "[toc]" ]]; then
10
- # 删除第一行以及后面的空行
11
- sed -i -e '1,/^$/d' "$file"
12
- fi
+DIRECTORIES=("_posts" "_tutorials")
+
+for dir in "${DIRECTORIES[@]}"; do
+ DIR=$(dirname "$(dirname "$(realpath "$0")")")/$dir
+ echo $DIR
+ for file in $DIR/*.md; do
+ if [[ $(head -n 1 "$file") == "[toc]" ]]; then
+ sed -i -e '1,/^$/d' "$file"
+ fi
13
+ done
14
done
15
0 commit comments