use std::collections::HashMap;
use std::io::{self, Write};
use crate::nodes::Sourcepos;
pub trait SyntaxHighlighterAdapter: Send + Sync {
fn write_highlighted(
&self,
output: &mut dyn Write,
lang: Option<&str>,
code: &str,
) -> io::Result<()>;
fn write_pre_tag(
&self,
output: &mut dyn Write,
attributes: HashMap<String, String>,
) -> io::Result<()>;
fn write_code_tag(
&self,
output: &mut dyn Write,
attributes: HashMap<String, String>,
) -> io::Result<()>;
}
#[derive(Clone, Debug)]
pub struct HeadingMeta {
pub level: u8,
pub content: String,
}
pub trait HeadingAdapter: Send + Sync {
fn enter(
&self,
output: &mut dyn Write,
heading: &HeadingMeta,
sourcepos: Option<Sourcepos>,
) -> io::Result<()>;
fn exit(&self, output: &mut dyn Write, heading: &HeadingMeta) -> io::Result<()>;
}