use std::path::Path;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum InputFormat {
#[cfg(feature = "html")]
Html,
#[cfg(feature = "markdown")]
Markdown,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum OutputFormat {
#[cfg(feature = "blocknote")]
Blocknote,
#[cfg(feature = "oxa")]
Oxa,
}
#[inline]
#[must_use]
pub fn detect_input_format(path: &Path) -> Option<InputFormat> {
let ext = path.extension()?.to_str()?.to_ascii_lowercase();
match ext.as_str() {
#[cfg(feature = "markdown")]
"md" | "markdown" => Some(InputFormat::Markdown),
#[cfg(feature = "html")]
"html" | "htm" => Some(InputFormat::Html),
_ => None,
}
}
#[inline]
#[must_use]
pub fn detect_output_format(path: &Path) -> Option<OutputFormat> {
let ext = path.extension()?.to_str()?.to_ascii_lowercase();
match ext.as_str() {
#[cfg(feature = "blocknote")]
"json" => Some(OutputFormat::Blocknote),
_ => None,
}
}