From 5addc437b188ae9ba52337823275db0d651fe6a2 Mon Sep 17 00:00:00 2001 From: Neville Li Date: Mon, 7 Aug 2017 15:05:48 -0400 Subject: [PATCH 1/2] remove extra white spaces --- gh-md-toc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gh-md-toc b/gh-md-toc index 0854ac4..971b527 100755 --- a/gh-md-toc +++ b/gh-md-toc @@ -61,7 +61,7 @@ gh_toc_md2html() { # gh_is_url() { case $1 in - https* | http*) + https* | http*) echo "yes";; *) echo "no";; From f8d16297946aae49a06af38ee86ef88393a9bce2 Mon Sep 17 00:00:00 2001 From: Neville Li Date: Mon, 7 Aug 2017 15:05:42 -0400 Subject: [PATCH 2/2] check for github token --- gh-md-toc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gh-md-toc b/gh-md-toc index 971b527..e0c3cb1 100755 --- a/gh-md-toc +++ b/gh-md-toc @@ -51,9 +51,14 @@ gh_toc_load() { #

Hello world github/linguist#1 cool, and #1!

'" gh_toc_md2html() { local gh_file_md=$1 + URL=https://api.github.com/markdown/raw + TOKEN="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" + if [ -f "$TOKEN" ]; then + URL="$URL?access_token=$(cat $TOKEN)" + fi curl -s --user-agent "$gh_user_agent" \ --data-binary @"$gh_file_md" -H "Content-Type:text/plain" \ - https://api.github.com/markdown/raw + $URL } #