Skip to content

Commit

Permalink
decode urlencoded characters to make the link looks better
Browse files Browse the repository at this point in the history
  • Loading branch information
zer4tul committed Jul 7, 2015
1 parent e1ab9f2 commit 9423ff7
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 9423ff7

Please sign in to comment.