Skip to content

Commit f8d1629

Browse files
committed
check for github token
1 parent 5addc43 commit f8d1629

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gh-md-toc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,14 @@ gh_toc_load() {
5151
# <p>Hello world github/linguist#1 <strong>cool</strong>, and #1!</p>'"
5252
gh_toc_md2html() {
5353
local gh_file_md=$1
54+
URL=https://api.github.com/markdown/raw
55+
TOKEN="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt"
56+
if [ -f "$TOKEN" ]; then
57+
URL="$URL?access_token=$(cat $TOKEN)"
58+
fi
5459
curl -s --user-agent "$gh_user_agent" \
5560
--data-binary @"$gh_file_md" -H "Content-Type:text/plain" \
56-
https://api.github.com/markdown/raw
61+
$URL
5762
}
5863

5964
#

0 commit comments

Comments
 (0)