diff --git a/parser/parser_test.go b/parser/parser_test.go index c3cbc3b0..5577f964 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -414,6 +414,24 @@ a: hoge fuga piyo +`, + }, + { + ` +a: | + bbbbbbb + + + ccccccc +d: eeeeeeeeeeeeeeeee +`, + ` +a: | + bbbbbbb + + + ccccccc +d: eeeeeeeeeeeeeeeee `, }, } diff --git a/scanner/scanner.go b/scanner/scanner.go index 47e9c882..fdcffe87 100644 --- a/scanner/scanner.go +++ b/scanner/scanner.go @@ -102,6 +102,9 @@ func (s *Scanner) isNeededKeepPreviousIndentNum(ctx *Context, c rune) bool { } func (s *Scanner) updateIndent(ctx *Context, c rune) { + if s.isFirstCharAtLine && c == '\n' && ctx.isDocument() { + return + } if s.isFirstCharAtLine && c == ' ' { s.indentNum++ return