Skip to main content

MarkdownProcessor

Trait MarkdownProcessor 

Source
pub trait MarkdownProcessor: Send + Sync {
    // Required methods
    fn process(
        &self,
        body: &str,
        frontmatter: &Value,
    ) -> Result<String, DocError>;
    fn name(&self) -> &str;
}
Expand description

A Markdown processor that transforms the raw body before title/template resolution.

Processors run in registration order on the raw body immediately after frontmatter split, and their output feeds title/template resolution and markdown rendering.

§Naming Contract

The name() method returns a unique identifier for this processor. It must be non-empty, ASCII-only, and a valid bare Tera identifier ([a-z0-9_]+). An invalid name will be rejected at build time.

Required Methods§

Source

fn process(&self, body: &str, frontmatter: &Value) -> Result<String, DocError>

Transforms body in the context of this page’s frontmatter, returning the processed body or a DocError.

Errors should be prefixed with name() for attribution, e.g. "litmus: ..." so callers know which processor failed.

Source

fn name(&self) -> &str

Returns the name of this processor, used to detect duplicates and for error attribution. Must be non-empty, ASCII-only, and a valid Tera identifier.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§