use crate::widgets::markdown_widget::foundation::elements::{
ElementKind, MarkdownElement, TextSegment,
};
pub fn flush_paragraph(
lines: &mut Vec<MarkdownElement>,
segments: &mut Vec<TextSegment>,
blockquote_depth: usize,
section_id: Option<usize>,
source_line: usize,
) {
if segments.is_empty() {
return;
}
let content = std::mem::take(segments);
if blockquote_depth > 0 {
lines.push(MarkdownElement {
kind: ElementKind::Blockquote {
content,
depth: blockquote_depth,
},
section_id,
source_line,
});
} else {
lines.push(MarkdownElement {
kind: ElementKind::Paragraph(content),
section_id,
source_line,
});
}
}