block: avoid panic on too short table line
This commit is contained in:
parent
28c2bfbe8c
commit
c4a3acaf70
1 changed files with 2 additions and 1 deletions
|
@ -604,7 +604,8 @@ impl IdentifiedBlock {
|
||||||
.then(|| (Kind::Atom(Attributes), Span::by_len(indent, l))),
|
.then(|| (Kind::Atom(Attributes), Span::by_len(indent, l))),
|
||||||
'|' => {
|
'|' => {
|
||||||
// FIXME: last byte may be pipe but end of prefixed unicode char
|
// FIXME: last byte may be pipe but end of prefixed unicode char
|
||||||
(line.as_bytes()[lt - 1] == b'|' && line.as_bytes()[lt - 2] != b'\\')
|
((lt >= 2 && line.as_bytes()[lt - 1] == b'|')
|
||||||
|
&& ((lt >= 3) && line.as_bytes()[lt - 2] != b'\\'))
|
||||||
.then(|| (Kind::Table { caption: false }, Span::empty_at(indent)))
|
.then(|| (Kind::Table { caption: false }, Span::empty_at(indent)))
|
||||||
}
|
}
|
||||||
'[' => chars.as_str().find("]:").map(|l| {
|
'[' => chars.as_str().find("]:").map(|l| {
|
||||||
|
|
Loading…
Reference in a new issue