block: parse captions

This commit is contained in:
Noah Hellman 2023-01-26 20:16:20 +01:00
parent 99f10fda4c
commit 8339befe2f
3 changed files with 111 additions and 6 deletions

View file

@ -56,6 +56,8 @@ pub enum Container<'s> {
Heading { level: usize },
/// A cell element of row within a table.
TableCell { alignment: Alignment, head: bool },
/// A caption within a table.
Caption,
/// A term within a description list.
DescriptionTerm,
/// A block with raw markup for a specific output format.
@ -111,6 +113,7 @@ impl<'s> Container<'s> {
| Self::Paragraph
| Self::Heading { .. }
| Self::TableCell { .. }
| Self::Caption
| Self::DescriptionTerm
| Self::RawBlock { .. }
| Self::CodeBlock { .. } => true,
@ -148,6 +151,7 @@ impl<'s> Container<'s> {
Self::Paragraph
| Self::Heading { .. }
| Self::TableCell { .. }
| Self::Caption
| Self::DescriptionTerm
| Self::RawBlock { .. }
| Self::CodeBlock { .. }
@ -541,6 +545,7 @@ impl<'s> Parser<'s> {
alignment,
head: self.table_head_row,
},
block::Leaf::Caption => Container::Caption,
block::Leaf::LinkDefinition => unreachable!(),
}
}