heading event: limit level to u16

This commit is contained in:
Noah Hellman 2023-01-29 13:34:10 +01:00
parent 1135cf7054
commit 493a9b3563

View file

@ -55,7 +55,7 @@ pub enum Container<'s> {
/// A paragraph. /// A paragraph.
Paragraph, Paragraph,
/// A heading. /// A heading.
Heading { level: usize }, Heading { level: u16 },
/// A cell element of row within a table. /// A cell element of row within a table.
TableCell { alignment: Alignment, head: bool }, TableCell { alignment: Alignment, head: bool },
/// A caption within a table. /// A caption within a table.
@ -560,7 +560,7 @@ impl<'s> Parser<'s> {
match l { match l {
block::Leaf::Paragraph => Container::Paragraph, block::Leaf::Paragraph => Container::Paragraph,
block::Leaf::Heading => Container::Heading { block::Leaf::Heading => Container::Heading {
level: content.len(), level: content.len().try_into().unwrap(),
}, },
block::Leaf::CodeBlock => { block::Leaf::CodeBlock => {
if let Some(format) = content.strip_prefix('=') { if let Some(format) = content.strip_prefix('=') {