Files
marginal/src/parser/mod.rs
Kerdonov 17185d4420
All checks were successful
Test the running changes / Test (push) Successful in 40s
added html generation
2025-12-15 01:19:23 +02:00

33 lines
765 B
Rust

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),
}
}
}