use comrak::nodes::{AstNode, NodeValue, Sourcepos};
use super::definitions::{self, Defined};
pub(super) fn precedes_table<'b>(paragraph: &'b AstNode<'b>) -> bool {
let end = paragraph.data().sourcepos.end.line;
paragraph.next_sibling().is_some_and(|t| {
let t = t.data();
matches!(t.value, NodeValue::Table(_)) && t.sourcepos.start.line == end + 1
})
}
pub(in crate::markdown) fn written_pos<'b>(
node: &'b AstNode<'b>,
lines: &[&str],
defined: &Defined,
) -> Sourcepos {
definitions::inline_pos(node, lines, defined)
}
pub(super) fn line_at<'a>(lines: &[&'a str], n: usize) -> &'a str {
n.checked_sub(1)
.and_then(|i| lines.get(i))
.copied()
.unwrap_or("")
}