diff --git a/ghdoc.go b/ghdoc.go
index 478b4af..0ce5a50 100644
--- a/ghdoc.go
+++ b/ghdoc.go
@@ -153,11 +153,13 @@ func (doc *GHDoc) GrabToc() *GHToc {
doc.d("GrabToc: start, html size: " + strconv.Itoa(len(doc.html)))
defer doc.d("GrabToc: done.")
- re := `(?si) All plugins are in the directory
nv-plugins.
If you need to add support for a new language you should add it as plugin
inside this directory. If you create a plugin which builds all stuff from source then In a simplest
case you need to implement 2 functions in the plugin's body: This function should return list of available versions of the plugin.
For example:
+ README in another language
README in another language
`,
AbsPaths: false,
Depth: 0,
@@ -43,17 +47,19 @@ func TestGrabTocOneRow(t *testing.T) {
}
func TestGrabTocOneRowWithNewLines(t *testing.T) {
+ // https://raw.githubusercontent.com/ekalinin/envirius/f939d3b6882bfb6ecb28ef7b6e62862f934ba945/README.md
+ // $ go run cmd/gh-md-toc/main.go --debug https://raw.githubusercontent.com/ekalinin/envirius/f939d3b6882bfb6ecb28ef7b6e62862f934ba945/README.md
tocExpected := []string{
"* [README in another language](#readme-in-another-language)",
}
doc := &GHDoc{
html: `
-
-
+
- README in another language
-
+
+ README in another language
+
+
+
`, AbsPaths: false,
Depth: 0,
Escape: true,
@@ -66,7 +72,8 @@ func TestGrabTocOneRowWithNewLines(t *testing.T) {
}
func TestGrabTocMultilineOriginGithub(t *testing.T) {
-
+ // https://github.com/ekalinin/envirius/blob/master/README.md#how-to-add-a-plugin
+ // $ go run cmd/gh-md-toc/main.go --debug https://raw.githubusercontent.com/ekalinin/envirius/f939d3b6882bfb6ecb28ef7b6e62862f934ba945/README.md
tocExpected := []string{
"* [How to add a plugin?](#how-to-add-a-plugin)",
" * [Mandatory elements](#mandatory-elements)",
@@ -74,20 +81,15 @@ func TestGrabTocMultilineOriginGithub(t *testing.T) {
}
doc := &GHDoc{
html: `
-
-
+ How to add a plugin?
How to add a plugin?
-
+ Mandatory elements
Mandatory elements
-
+ plug_list_versions
plug_list_versions
foo1
-foo1
+Blabla...
- -foo2
is betterfoo2
is betterBlabla...
- -bar1
-bar1
+Blabla...
- -bar2
is betterbar2
is betterBlabla...
+bar3
is the bestBlabla...
`, AbsPaths: false, Depth: 0, @@ -147,6 +142,8 @@ func TestGrabTocBackquoted(t *testing.T) { } func TestGrabTocDepth(t *testing.T) { + // https://github.com/ekalinin/github-markdown-toc/blob/656b34011a482544a9ebb4116332c044834bdbbf/tests/test%20directory/test_backquote.md + // $ go run cmd/gh-md-toc/main.go --debug https://raw.githubusercontent.com/ekalinin/github-markdown-toc/656b34011a482544a9ebb4116332c044834bdbbf/tests/test%20directory/test_backquote.md tocExpected := []string{ "* [The command foo1](#the-command-foo1)", "* [The command bar1](#the-command-bar1)", @@ -154,26 +151,17 @@ func TestGrabTocDepth(t *testing.T) { doc := &GHDoc{ html: ` -foo1
-foo1
+Blabla...
- -foo2
is betterfoo2
is betterBlabla...
- -bar1
-bar1
+Blabla...
- -bar2
is betterbar2
is betterBlabla...
+bar3
is the bestBlabla...
`, AbsPaths: false, Escape: true, @@ -190,45 +178,27 @@ func TestGrabTocDepth(t *testing.T) { } func TestGrabTocStartDepth(t *testing.T) { + // https://github.com/ekalinin/github-markdown-toc/blob/656b34011a482544a9ebb4116332c044834bdbbf/tests/test%20directory/test_backquote.md + // $ go run cmd/gh-md-toc/main.go --debug https://raw.githubusercontent.com/ekalinin/github-markdown-toc/656b34011a482544a9ebb4116332c044834bdbbf/tests/test%20directory/test_backquote.md tocExpected := []string{ "* [The command foo2 is better](#the-command-foo2-is-better)", - " * [The command foo3 is even betterer](#the-command-foo3-is-even-betterer)", "* [The command bar2 is better](#the-command-bar2-is-better)", - " * [The command bar3 is even betterer](#the-command-bar3-is-even-betterer)", + " * [The command bar3 is the best](#the-command-bar3-is-the-best)", } doc := &GHDoc{ html: ` -foo1
-foo1
+Blabla...
- -foo2
is betterfoo2
is betterBlabla...
- -foo3
is even betterer
-
+bar1
+Blabla...
- -bar1
-bar2
is betterBlabla...
- -bar2
is betterBlabla...
- -bar3
is even betterer
-
+bar3
is the bestBlabla...
`, AbsPaths: false, Escape: true, @@ -251,7 +221,7 @@ func TestGrabTocWithAbspath(t *testing.T) { } doc := &GHDoc{ html: ` -Uno
-Dos
-Tres
`, +