Skip to content

Commit

Permalink
Issue #4: Fix invalid leading spaces with attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
yuin committed May 15, 2019
1 parent 6703518 commit e481813
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions parser/atx_heading.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,13 @@ func (b *atxHeadingParser) Open(parent ast.Node, reader text.Reader, pc Context)
return nil, NoChildren
}
start := i + l
origstart := start
stop := len(line) - util.TrimRightSpaceLength(line)

node := ast.NewHeading(level)
parsed := false
if b.Attribute { // handles special case like ### heading ### {#id}
if line[start] == '#' {
start--
}
start--
closureOpen := -1
closureClose := -1
for i := start; i < stop; {
Expand Down Expand Up @@ -141,6 +140,7 @@ func (b *atxHeadingParser) Open(parent ast.Node, reader text.Reader, pc Context)
}
}
if !parsed {
start = origstart
stop := len(line) - util.TrimRightSpaceLength(line)
if stop <= start { // empty headings like '##[space]'
stop = start + 1
Expand Down

0 comments on commit e481813

Please sign in to comment.