Skip to content

Commit

Permalink
fix: check head indexes before removing
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Jun 30, 2022
1 parent 672511a commit 6fc7ecb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/lint/dita.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ func (l Linter) lintDITA(file *core.File) error {
head1 := bytes.Index(data, []byte("<head>"))
head2 := bytes.Index(data, []byte("</head>"))

return l.lintHTMLTokens(
file, append(data[:head1], data[head2:]...), 0)
if head1 >= 0 && head2 >= 0 {
data = append(data[:head1], data[head2:]...)
}

return l.lintHTMLTokens(file, data, 0)
}

0 comments on commit 6fc7ecb

Please sign in to comment.