pub trait Plugin: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn process_line(
&mut self,
line: &str,
state: &ParseState,
style: &ComputedStyle,
) -> Option<ProcessResult>;
fn flush(&mut self) -> Option<Vec<String>>;
fn reset(&mut self);
// Provided methods
fn priority(&self) -> i32 { ... }
fn is_active(&self) -> bool { ... }
}Expand description
Plugin trait for custom content processors.
Plugins intercept input lines and can:
- Transform them into different output
- Buffer multiple lines before emitting
- Pass through to normal processing
Required Methods§
Sourcefn process_line(
&mut self,
line: &str,
state: &ParseState,
style: &ComputedStyle,
) -> Option<ProcessResult>
fn process_line( &mut self, line: &str, state: &ParseState, style: &ComputedStyle, ) -> Option<ProcessResult>
Process a line of input.
§Returns
None: Plugin not interested, continue normal processingSome(ProcessResult::Lines(vec)): Emit these lines insteadSome(ProcessResult::Continue): Plugin consumed input, keep buffering