Skip to content

Commit f8d919e

Browse files
authored
Merge pull request ekalinin#127 from Captn138/master
Fix for ekalinin#114
2 parents ddc22f1 + 31d8a3b commit f8d919e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ You can easily combine both ways:
229229
* [Usage](https://github.com/ekalinin/sitemap.js/blob/master/README.md#usage)
230230
* [License](https://github.com/ekalinin/sitemap.js/blob/master/README.md#license)
231231
232-
Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
232+
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
233233
```
234234
235235
Auto insert and update TOC
@@ -266,7 +266,7 @@ Table of Contents
266266
!! TOC added into a separate file: 'README.test.md.toc.2018-02-04_192655'
267267
268268
269-
Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
269+
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
270270
```
271271
272272
Now check the same file:

gh-md-toc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,15 @@ gh_toc(){
164164
local dt=`date +'%F_%H%M%S'`
165165
local ext=".orig.${dt}"
166166
local toc_path="${gh_src}.toc.${dt}"
167+
local toc_createdby="<!-- Created by https://github.com/ekalinin/github-markdown-toc -->"
167168
local toc_footer="<!-- Added by: `whoami`, at: `date` -->"
168169
# http://fahdshariff.blogspot.ru/2012/12/sed-mutli-line-replacement-between-two.html
169170
# clear old TOC
170171
sed -i${ext} "/${ts}/,/${te}/{//!d;}" "$gh_src"
171172
# create toc file
172173
echo "${toc}" > "${toc_path}"
173174
if [ "${no_footer}" != "yes" ]; then
174-
echo -e "\n${toc_footer}\n" >> "$toc_path"
175+
echo -e "\n${toc_createdby}\n${toc_footer}\n" >> "$toc_path"
175176
fi
176177

177178
# insert toc file
@@ -351,7 +352,7 @@ gh_toc_app() {
351352
done
352353

353354
echo ""
354-
echo "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)"
355+
echo "<!-- Created by https://github.com/ekalinin/github-markdown-toc -->"
355356
}
356357

357358
#

tests/tests.bats

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ load test_helper
2626
assert_equal "${lines[16]}" "* [Docker](#docker)"
2727
assert_equal "${lines[17]}" " * [Local](#local)"
2828
assert_equal "${lines[18]}" " * [Public](#public)"
29-
assert_equal "${lines[19]}" "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)"
29+
assert_equal "${lines[19]}" "<!-- Created by https://github.com/ekalinin/github-markdown-toc) -->
3030
3131
}
3232
@@ -40,7 +40,7 @@ load test_helper
4040
assert_equal "${lines[3]}" " * [Installation](#installation)"
4141
assert_equal "${lines[4]}" " * [Usage](#usage)"
4242
assert_equal "${lines[5]}" " * [License](#license)"
43-
assert_equal "${lines[6]}" "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)"
43+
assert_equal "${lines[6]}" "<!-- Created by https://github.com/ekalinin/github-markdown-toc) -->
4444
}
4545
4646
@test "TOC for mixed README.md (remote/local)" {
@@ -70,7 +70,7 @@ load test_helper
7070
assert_equal "${lines[18]}" " * [Installation](https://github.com/ekalinin/sitemap.js/blob/6bc3eb12c898c1037a35a11b2eb24ababdeb3580/README.md#installation)"
7171
assert_equal "${lines[19]}" " * [Usage](https://github.com/ekalinin/sitemap.js/blob/6bc3eb12c898c1037a35a11b2eb24ababdeb3580/README.md#usage)"
7272
assert_equal "${lines[20]}" " * [License](https://github.com/ekalinin/sitemap.js/blob/6bc3eb12c898c1037a35a11b2eb24ababdeb3580/README.md#license)"
73-
assert_equal "${lines[21]}" "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)"
73+
assert_equal "${lines[21]}" "<!-- Created by https://github.com/ekalinin/github-markdown-toc) -->
7474
}
7575

7676
@test "TOC for markdown from stdin" {

0 commit comments

Comments
 (0)