This commit is contained in:
yuin 2021-09-11 09:55:07 +09:00
parent fad80b4f0c
commit 466482bf19
2 changed files with 11 additions and 0 deletions

View file

@ -380,3 +380,10 @@ a* b c d *e*
//- - - - - - - - -//
<aaa >
//= = = = = = = = = = = = = = = = = = = = = = = =//
25: code block starts with tab
//- - - - - - - - -//
x
//- - - - - - - - -//
<pre><code> x</code></pre>
//= = = = = = = = = = = = = = = = = = = = = = = =//

View file

@ -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