Skip to content

Commit

Permalink
Revert "Prevent panic in format_item"
Browse files Browse the repository at this point in the history
This reverts commit 20629d3.
  • Loading branch information
silverpill committed Nov 13, 2024
1 parent 2d36cdb commit db7a3d6
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/cm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,19 +465,11 @@ impl<'a, 'o> CommonMarkFormatter<'a, 'o> {
let marker_width = if parent.list_type == ListType::Bullet {
2
} else {
let list_number = if let Some(last_stack) = self.ol_stack.last_mut() {
let list_number = *last_stack;
if entering {
*last_stack += 1;
};
list_number
} else {
match node.data.borrow().value {
NodeValue::Item(ref ni) => ni.start,
NodeValue::TaskItem(_) => parent.start,
_ => unreachable!(),
}
};
let last_stack = self.ol_stack.last_mut().unwrap();
let list_number = *last_stack;
if entering {
*last_stack += 1;
}
let list_delim = parent.delimiter;
write!(
listmarker,
Expand Down

0 comments on commit db7a3d6

Please sign in to comment.