use std::fmt::{Debug, Display}; pub mod block; pub mod inline; #[derive(Debug)] pub struct MarkdownParseError { kind: nom::error::ErrorKind, message: String, } impl Display for MarkdownParseError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}, {}", self.kind, self.message) } } impl nom::error::ParseError<&str> for MarkdownParseError { fn from_error_kind(input: &str, kind: nom::error::ErrorKind) -> Self { Self { kind, message: format!("at: {}", input), } } fn append(input: &str, kind: nom::error::ErrorKind, other: Self) -> Self { Self { kind, message: format!("{}\nat: {}", other, input), } } }