Skip to content

Commit 8daa73c

Browse files
author
Stefan Fruhner
committed
Skip headers if end marker is present
1 parent 17ec017 commit 8daa73c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

gh-md-toc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,22 @@ gh_toc_md2html() {
6565
AUTHORIZATION="Authorization: token ${TOKEN}"
6666
fi
6767

68+
local gh_tmp_file_md=$gh_file_md
69+
if grep -Fxq "<!--te-->" $gh_src; then
70+
# cut everything before the toc
71+
gh_tmp_file_md=$gh_file_md~~
72+
sed '1,/<!--te-->/d' $gh_file_md > $gh_tmp_file_md
73+
74+
fi
75+
6876
# echo $URL 1>&2
6977
OUTPUT=$(curl -s \
7078
--user-agent "$gh_user_agent" \
71-
--data-binary @"$gh_file_md" \
79+
--data-binary @"$gh_tmp_file_md" \
7280
-H "Content-Type:text/plain" \
7381
-H "$AUTHORIZATION" \
7482
"$URL")
83+
rm -f $gh_file_md~~
7584

7685
if [ "$?" != "0" ]; then
7786
echo "XXNetworkErrorXX"

0 commit comments

Comments
 (0)