Skip to content

Commit

Permalink
Merge pull request ekalinin#10 from zer4tul/master
Browse files Browse the repository at this point in the history
decode urlencoded characters to make the link looks better
  • Loading branch information
ekalinin committed Jul 7, 2015
2 parents e1ab9f2 + 9423ff7 commit b8e7d6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gh-md-toc
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ gh_toc(){
# It's need if TOC is generated for multiple documents.
#
gh_toc_grab() {
awk -v "gh_url=$1" '/user-content-/ {
print sprintf("%*s", substr($NF, length($NF)-1, 1)*2, " ") "* [" substr($0, match($0, /a>.*<\/h/)+2, RLENGTH-5)"](" gh_url substr($0, match($0, "href=\".*\" ")+6, RLENGTH-8) ")"}'
echo -e "$(awk -v "gh_url=$1" '/user-content-/ {
print sprintf("%*s", substr($NF, length($NF)-1, 1)*2, " ") "* [" substr($0, match($0, /a>.*<\/h/)+2, RLENGTH-5)"](" gh_url substr($0, match($0, "href=\".*\" ")+6, RLENGTH-8) ")"}' | sed 'y/+/ /; s/%/\\x/g')"
}

#
Expand Down

0 comments on commit b8e7d6f

Please sign in to comment.