diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go index 8f855f1b13..caffe0ea43 100644 --- a/modules/markup/markdown/markdown_test.go +++ b/modules/markup/markdown/markdown_test.go @@ -510,6 +510,18 @@ func TestMathBlock(t *testing.T) { "$$a$$", `
a
` + nl,
},
+ {
+ `\[a b\]`,
+ `a b
` + nl,
+ },
+ {
+ `\[a b]`,
+ `[a b]
` + nl, + }, + { + `$$a`, + `$$a
` + nl, + }, } for _, test := range testcases { diff --git a/modules/markup/markdown/math/block_parser.go b/modules/markup/markdown/math/block_parser.go index 7f714d7239..f3262c82c0 100644 --- a/modules/markup/markdown/math/block_parser.go +++ b/modules/markup/markdown/math/block_parser.go @@ -55,10 +55,7 @@ func (b *blockParser) Open(parent ast.Node, reader text.Reader, pc parser.Contex return node, parser.Close | parser.NoChildren } - reader.Advance(segment.Len() - 1) - segment.Start += 2 - node.Lines().Append(segment) - return node, parser.NoChildren + return nil, parser.NoChildren } // Continue parses the current line and returns a result of parsing.