go-term-markdown
go-term-markdown copied to clipboard
Occur panic when Render function argument "lineWidth" is -1
I use Render function using argument "lineWidth" is -1, then occured panic.
body = string(markdown.Render(body, -1, 0))
panic: strings: negative Repeat count
goroutine 1 [running]:
strings.Repeat(0xb5bf41, 0x3, 0xffffffffffffffff, 0x1, 0x1)
/usr/lib/go-1.13/src/strings/strings.go:533 +0x5aa
github.com/MichaelMure/go-term-markdown.(*renderer).renderHeading(0xc001b5e280, 0xccb7c0, 0xc0004dfd40, 0x1)
/home/skanehira/go/pkg/mod/github.com/!michael!mure/[email protected]/renderer.go:442 +0x3ae
github.com/MichaelMure/go-term-markdown.(*renderer).RenderNode(0xc001b5e280, 0xccb7c0, 0xc0004dfd40, 0xcda440, 0xc000555280, 0xc000636000, 0x1)
/home/skanehira/go/pkg/mod/github.com/!michael!mure/[email protected]/renderer.go:263 +0xcbe
github.com/gomarkdown/markdown.Render.func1(0xcda440, 0xc000555280, 0x0, 0x0)
/home/skanehira/go/pkg/mod/github.com/gomarkdown/[email protected]/markdown.go:63 +0x61
github.com/gomarkdown/markdown/ast.NodeVisitorFunc.Visit(0xc00013a6e0, 0xcda440, 0xc000555280, 0xc00013a600, 0x0)
/home/skanehira/go/pkg/mod/github.com/gomarkdown/[email protected]/ast/node.go:552 +0x43
github.com/gomarkdown/markdown/ast.Walk(0xcda440, 0xc000555280, 0xccc8e0, 0xc00013a6e0, 0x0)
/home/skanehira/go/pkg/mod/github.com/gomarkdown/[email protected]/ast/node.go:542 +0x12b
github.com/gomarkdown/markdown/ast.Walk(0xcda1a0, 0xc0004d62a0, 0xccc8e0, 0xc00013a6e0, 0xc0004d62a0)
/home/skanehira/go/pkg/mod/github.com/gomarkdown/[email protected]/ast/node.go:535 +0x1ba
github.com/gomarkdown/markdown/ast.WalkFunc(...)
/home/skanehira/go/pkg/mod/github.com/gomarkdown/[email protected]/ast/node.go:558
github.com/gomarkdown/markdown.Render(0xcda1a0, 0xc0004d62a0, 0xcd5d80, 0xc001b5e280, 0x0, 0xc001b5e280, 0xd0)
/home/skanehira/go/pkg/mod/github.com/gomarkdown/[email protected]/markdown.go:62 +0xe4
github.com/MichaelMure/go-term-markdown.Render(0xc0001df800, 0xae3, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x5c51b4, 0xc00028e090, 0x0)
/home/skanehira/go/pkg/mod/github.com/!michael!mure/[email protected]/markdown.go:25 +0x106
github.com/skanehira/gota/common.ViewTerminal(0xc0001df800, 0xae3, 0x0, 0x1)
/home/skanehira/go/src/github.com/skanehira/gota/common/common.go:34 +0x25f
github.com/skanehira/gota/app.(*App).confirm(0xc00042dac0, 0xc000026380, 0x35, 0xc0001df800, 0xae3, 0x2193, 0x0)
/home/skanehira/go/src/github.com/skanehira/gota/app/app.go:196 +0x2cd
github.com/skanehira/gota/app.(*App).selecter(0xc00042dac0, 0xc001a26000, 0x64, 0x8d, 0x8d, 0x0)
/home/skanehira/go/src/github.com/skanehira/gota/app/app.go:153 +0x1cc
github.com/skanehira/gota/app.(*App).Run(0xc00042dac0, 0x5ae00, 0xc00002e178)
/home/skanehira/go/src/github.com/skanehira/gota/app/app.go:106 +0x1b9
main.main()
/home/skanehira/go/src/github.com/skanehira/gota/main.go:8 +0x27
exit status 2
Hmm, the panic is a bit excessive but a negative number of column to render on is clearly incorrect. What behavior would you expect there ?
I would expect that to mean ignore line width so output is one big line