Skip to main content

MarkdownAnalyzer

Trait MarkdownAnalyzer 

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

A Markdown analyzer that extracts metadata from the body for template rendering.

Analyzers run after processors, and their results are merged into the Tera context under page.extensions.<name()> where templates can render them.

§Naming Contract

The name() method returns a unique identifier for this analyzer. 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. Analyzer names are scoped separately from processor names — a processor and analyzer may share a name without conflict.

Required Methods§

Source

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

Analyzes body in the context of this page’s frontmatter, returning a JSON object with metadata or a DocError.

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

Source

fn name(&self) -> &str

Returns the name of this analyzer, used to detect duplicates and as the key in page.extensions.<name()>. 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§