pub trait DocumentPlugin: Send + Sync {
// Required method
fn meta(&self) -> &PluginMeta;
// Provided methods
fn setup(&mut self, config: Option<HashMap<String, NargoValue>>) { ... }
fn before_render(&self, context: PluginContext) -> PluginContext { ... }
fn after_render(&self, context: PluginContext) -> PluginContext { ... }
}Expand description
文档插件 Trait 定义插件需要实现的钩子方法
Required Methods§
Sourcefn meta(&self) -> &PluginMeta
fn meta(&self) -> &PluginMeta
获取插件元数据
Provided Methods§
Sourcefn before_render(&self, context: PluginContext) -> PluginContext
fn before_render(&self, context: PluginContext) -> PluginContext
渲染前钩子 在 Markdown 解析后、HTML 渲染前调用,用于修改文档内容
Sourcefn after_render(&self, context: PluginContext) -> PluginContext
fn after_render(&self, context: PluginContext) -> PluginContext
渲染后钩子 在 HTML 渲染后调用,用于修改渲染后的内容