mdBook/src/preprocess/mod.rs

25 lines
480 B
Rust
Raw Normal View History

pub use self::links::LinkPreprocessor;
mod links;
2018-01-08 00:21:46 +08:00
use book::Book;
use config::Config;
2018-01-08 00:21:46 +08:00
use errors::*;
use std::path::PathBuf;
pub struct PreprocessorContext {
pub root: PathBuf,
pub config: Config,
}
impl PreprocessorContext {
pub fn new(root: PathBuf, config: Config) -> Self {
PreprocessorContext { root, config }
}
}
2018-01-08 00:21:46 +08:00
pub trait Preprocessor {
fn name(&self) -> &str;
fn run(&self, ctx: &PreprocessorContext, book: &mut Book) -> Result<()>;
}