We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If the markdown source contains two consecutive math blocks, the parser will fail with a panic https://go.dev/play/p/qvMPGNTfFXH
Source:
package main import ( "bytes" "fmt" mathjax "github.com/litao91/goldmark-mathjax" "github.com/yuin/goldmark" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer/html" ) func main() { md := goldmark.New( goldmark.WithExtensions(mathjax.MathJax), goldmark.WithParserOptions( parser.WithAutoHeadingID(), ), goldmark.WithRendererOptions( html.WithHardWraps(), html.WithXHTML(), ), ) var html bytes.Buffer mdContent := []byte(` $$ 1 $$ $$ 2 $$ `) if err := md.Convert(mdContent, &html); err != nil { fmt.Println(err) } fmt.Println(html.String()) }
Result:
panic: interface conversion: interface {} is nil, not *mathjax.mathBlockData goroutine 1 [running]: github.com/litao91/goldmark-mathjax.(*mathJaxBlockParser).Continue(0xc00017c310?, {0x61c520, 0xc000116f80}, {0x61bbb8, 0xc00017c310}, {0x61bea0, 0xc00017c380}) /tmp/gopath715487383/pkg/mod/github.com/litao91/[email protected]/block.go:47 +0x3b4 github.com/yuin/goldmark/parser.(*parser).parseBlocks(0xc000187508, {0x61c9a0, 0xc000190000}, {0x61bbb8, 0xc00017c310}, {0x61bea0, 0xc00017c380}) /tmp/gopath715487383/pkg/mod/github.com/yuin/[email protected]/parser/parser.go:1093 +0x5b9 github.com/yuin/goldmark/parser.(*parser).Parse(0xc000187508, {0x61bbb8, 0xc00017c310}, {0x0, 0x0, 0x40ce05?}) /tmp/gopath715487383/pkg/mod/github.com/yuin/[email protected]/parser/parser.go:876 +0x14b github.com/yuin/goldmark.(*markdown).Convert(0xc000172200, {0xc000164090, 0x11, 0x11}, {0x61a838, 0xc0000a9170}, {0x0, 0x0, 0x0}) /tmp/gopath715487383/pkg/mod/github.com/yuin/[email protected]/markdown.go:117 +0xce main.main() /tmp/sandbox2467797471/prog.go:34 +0x345
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If the markdown source contains two consecutive math blocks, the parser will fail with a panic
https://go.dev/play/p/qvMPGNTfFXH
Source:
Result:
The text was updated successfully, but these errors were encountered: