summaryrefslogtreecommitdiff
path: root/src/syntax/ast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax/ast.rs')
-rw-r--r--src/syntax/ast.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs
index b6f64c67..1198d6b1 100644
--- a/src/syntax/ast.rs
+++ b/src/syntax/ast.rs
@@ -156,7 +156,11 @@ impl HeadingNode {
/// The section depth (numer of equals signs).
pub fn level(&self) -> u8 {
- self.0.children().filter(|n| n.kind() == &NodeKind::Eq).count() as u8
+ self.0
+ .children()
+ .filter(|n| n.kind() == &NodeKind::Eq)
+ .count()
+ .min(u8::MAX.into()) as u8
}
}