Skip to main content

CodeBlockHandler

Trait CodeBlockHandler 

Source
pub trait CodeBlockHandler: Send + Sync {
    // Required method
    fn render<'a>(
        &'a self,
        language: &'a str,
        code: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<CodeBlockOutput>> + Send + 'a>>;
}
Expand description

A handler for rendering code blocks.

Implementations can provide syntax highlighting, diagram rendering, or any other transformation of code block content.

Required Methods§

Source

fn render<'a>( &'a self, language: &'a str, code: &'a str, ) -> Pin<Box<dyn Future<Output = Result<CodeBlockOutput>> + Send + 'a>>

Render a code block to HTML.

§Arguments
  • language - The language identifier (e.g., “rust”, “python”, “aa”, “pik”)
  • code - The raw code content
§Returns

A CodeBlockOutput containing the rendered HTML and any head injections, or an error if rendering fails.

Implementors§