Skip to main content

Preprocessor

Trait Preprocessor 

Source
pub trait Preprocessor {
    type Payload: Default;

    // Required method
    fn preprocess(
        &self,
        path: &Path,
        bytes: &[u8],
    ) -> Result<Option<PreprocessOutput<Self::Payload>>>;
}
Expand description

Per-file callback signature used by index_path_with_preprocessor.

Receives the file path and the raw bytes; may return Some(...) to supply a substitute body (e.g. with frontmatter stripped) and a payload with sidecar metadata. Returning None skips the file.

Required Associated Types§

Required Methods§

Source

fn preprocess( &self, path: &Path, bytes: &[u8], ) -> Result<Option<PreprocessOutput<Self::Payload>>>

Implementors§