Skip to content

Commit

Permalink
parser: Start new document on doc-start after content
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Oct 5, 2020
1 parent eb94811 commit 373ae03
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/parse/parser.ts
Expand Up @@ -285,7 +285,17 @@ export class Parser {
document(doc: Document) {
if (doc.value) return this.lineEnd(doc)
switch (this.type) {
case 'doc-start':
case 'doc-start': {
const hasContent = doc.start.some(
({ type }) =>
type === 'doc-start' || type === 'anchor' || type === 'tag'
)
if (hasContent) {
this.pop()
this.step()
} else doc.start.push(this.sourceToken)
return
}
case 'anchor':
case 'tag':
case 'space':
Expand Down

0 comments on commit 373ae03

Please sign in to comment.