use crate::config::OxContentConfig;
pub struct OxContentPlugin {
config: OxContentConfig,
}
impl OxContentPlugin {
#[must_use]
pub fn new(config: OxContentConfig) -> Self {
Self { config }
}
#[must_use]
pub fn config(&self) -> &OxContentConfig {
&self.config
}
#[must_use]
pub fn resolve_markdown(&self, path: &str) -> Option<String> {
let src_dir = &self.config.src_dir;
let is_markdown = std::path::Path::new(path)
.extension()
.is_some_and(|ext| ext.eq_ignore_ascii_case("md"));
if path.starts_with(src_dir) && is_markdown {
Some(path.to_string())
} else {
None
}
}
pub fn transform(&self, _path: &str, _content: &str) -> Result<String, String> {
Ok(String::new())
}
}
impl Default for OxContentPlugin {
fn default() -> Self {
Self::new(OxContentConfig::default())
}
}