Skip to content

Commit

Permalink
Use 3 space indent to support more than 3 levels of toc for GitLab
Browse files Browse the repository at this point in the history
We found that 2 space indent can not show 3 levels of toc on GitLab, but 3
space indent fix this and doesn't break GitHub.

Signed-off-by: Chengwei Yang <[email protected]>
  • Loading branch information
chengweiv5 committed Oct 21, 2016
1 parent 51e4538 commit 8cec2ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gh-md-toc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ gh_toc_grab() {
# format result line
# * $0 — whole string
echo -e "$(awk -v "gh_url=$1" '{
print sprintf("%*s", substr($0, length($0), 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')"
print sprintf("%*s", substr($0, length($0), 1)*3, " ") "* [" 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 8cec2ec

Please sign in to comment.