Address review comments

pull/521/head
Ignas Anikevicius 2019-01-21 13:29:05 +02:00
parent 7cd217fc0c
commit 9eb758b2de
1 changed files with 6 additions and 5 deletions

View File

@ -649,16 +649,17 @@ func isFenceLine(data []byte, info *string, oldmarker string, newlineOptional bo
}
i = skipChar(data, i, ' ')
if l := len(data); i >= l || data[i] != '\n' {
if newlineOptional && i == len(data) {
return i, marker
} else if !newlineOptional && i < l && data[l-1] == '\n' {
if i >= len(data) {
if newlineOptional {
return i, marker
}
return 0, ""
}
if data[i] == '\n' {
i++ // Take newline into account
}
return i + 1, marker // Take newline into account.
return i, marker
}
// fencedCodeBlock returns the end index if data contains a fenced code block at the beginning,