diff --git a/_test/extra.txt b/_test/extra.txt index 41b1d7d..8c9578f 100644 --- a/_test/extra.txt +++ b/_test/extra.txt @@ -380,3 +380,10 @@ a* b c d *e* //- - - - - - - - -// //= = = = = = = = = = = = = = = = = = = = = = = =// + +25: code block starts with tab +//- - - - - - - - -// + x +//- - - - - - - - -// +
	x
+//= = = = = = = = = = = = = = = = = = = = = = = =// diff --git a/parser/code_block.go b/parser/code_block.go index c16ea41..732f18c 100644 --- a/parser/code_block.go +++ b/parser/code_block.go @@ -31,6 +31,10 @@ func (b *codeBlockParser) Open(parent ast.Node, reader text.Reader, pc Context) node := ast.NewCodeBlock() reader.AdvanceAndSetPadding(pos, padding) _, segment = reader.PeekLine() + // if code block line starts with a tab, keep a tab as it is. + if segment.Padding != 0 { + preserveLeadingTabInCodeBlock(&segment, reader, 0) + } node.Lines().Append(segment) reader.Advance(segment.Len() - 1) return node, NoChildren