fixup! 6119d912876deec27ba2e97f160a044e3dc08819

This commit is contained in:
Noah Hellman 2022-12-02 20:07:37 +01:00
parent 6a0c1ca3f8
commit 7f540505a8

View file

@ -201,8 +201,9 @@ impl Block {
} }
} }
f @ ('`' | ':') => { f @ ('`' | ':') => {
let fence_length = chars.take_while(|c| *c == f).count() + 1; let fence_length = (&mut chars).take_while(|c| *c == f).count() + 1;
(fence_length >= 3) let valid_spec = !line[fence_length..].trim().chars().any(char::is_whitespace);
(valid_spec && fence_length >= 3)
.then(|| { .then(|| {
u8::try_from(fence_length).ok().map(|fence_length| { u8::try_from(fence_length).ok().map(|fence_length| {
( (
@ -247,6 +248,11 @@ impl Block {
!line.trim().is_empty() && spaces >= (indent).into() !line.trim().is_empty() && spaces >= (indent).into()
} }
Self::Container(Div { fence_length }) | Self::Leaf(CodeBlock { fence_length }) => { Self::Container(Div { fence_length }) | Self::Leaf(CodeBlock { fence_length }) => {
let fence = if matches!(self, Self::Container(..)) {
':'
} else {
'`'
};
let mut c = line.chars(); let mut c = line.chars();
!((&mut c).take((fence_length).into()).all(|c| c == ':') !((&mut c).take((fence_length).into()).all(|c| c == ':')
&& c.next().map_or(false, char::is_whitespace)) && c.next().map_or(false, char::is_whitespace))