Skip to content

Commit

Permalink
Fix row numbering
Browse files Browse the repository at this point in the history
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
  • Loading branch information
HenriquerPimentel and lunny committed Apr 10, 2024
1 parent e130b93 commit 6a45792
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/markup/csv/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (r Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.W
return err
}

row := 1
row := 0
for {
fields, err := rd.Read()
if err == io.EOF || (row >= maxRows && maxRows != 0) {
Expand All @@ -114,7 +114,7 @@ func (r Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.W
if row == 0 {
element = "th"
}
if err := writeField(tmpBlock, element, "line-num", strconv.Itoa(row)); err != nil {
if err := writeField(tmpBlock, element, "line-num", strconv.Itoa(row+1)); err != nil {
return err
}
for _, field := range fields {
Expand Down

0 comments on commit 6a45792

Please sign in to comment.