一键导入
extension-rendering
ComponentRenderer, TemplateProvider, TemplateDataExtender, and PagePrerenderer trait implementations
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
ComponentRenderer, TemplateProvider, TemplateDataExtender, and PagePrerenderer trait implementations
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Search the web for information using the WebSearch tool
Demonstrates governance blocking when plaintext secrets are detected in tool inputs
A simple demonstration skill that searches the web for information
Demonstration skill that attempts to use a plaintext secret, designed to be blocked by governance hooks
List, message, configure, and restart agents via the systemprompt CLI
View traffic, costs, agent stats, and bot detection via the systemprompt CLI
基于 SOC 职业分类
| name | Extension: Rendering |
| description | ComponentRenderer, TemplateProvider, TemplateDataExtender, and PagePrerenderer trait implementations |
Rendering traits control how pages are composed, how templates are provided, how template context is extended, and how static pages are pre-generated. All traits live in crates/shared/provider-contracts/src/.
Renders reusable UI components (header, footer, sidebar, partials) into page templates.
#[async_trait]
pub trait ComponentRenderer: Send + Sync {
fn component_id(&self) -> &str;
fn applies_to(&self) -> Vec<String>;
fn partial_template(&self) -> Option<PartialTemplate>;
async fn render(&self, ctx: &dyn ComponentRenderContext) -> Result<RenderedComponent>;
}
| Component | Renderer | Pages |
|---|---|---|
| Head assets | HeadAssetsPartialRenderer | All |
| Header | HeaderPartialRenderer | All |
| Footer | FooterPartialRenderer | All |
| Scripts | ScriptsPartialRenderer | All |
| CLI animation | CliRemoteAnimationPartialRenderer | Homepage |
impl Extension for MyExtension {
fn component_renderers(&self) -> Vec<Arc<dyn ComponentRenderer>> {
vec![Arc::new(MyComponent)]
}
}
Supplies page templates (embedded or file-based) for rendering.
pub trait TemplateProvider: Send + Sync {
fn templates(&self) -> Vec<TemplateDefinition>;
fn provider_id(&self) -> &'static str;
fn priority(&self) -> u32;
}
| Priority | Source |
|---|---|
| 100 | Extension templates (override core) |
| 1000 | Core default templates (fallback) |
Lower priority wins. Extension templates override core.
Injects variables into template rendering context. Runs before template compilation.
#[async_trait]
pub trait TemplateDataExtender: Send + Sync {
fn applies_to(&self) -> Vec<String>;
async fn extend(&self, ctx: &dyn ExtenderContext, data: &mut Value) -> Result<()>;
fn priority(&self) -> u32;
}
| Variable | Type | Source |
|---|---|---|
site | Object | Full site configuration |
title | String | Page title |
CONTENT_HTML | String | Rendered markdown |
ORG_NAME | String | Organization name |
JS_BASE_PATH | String | JavaScript directory |
CSS_BASE_PATH | String | CSS directory |
FOOTER_NAV | String | Footer navigation HTML |
Generates static HTML pages at build time. Runs during content_prerender job.
#[async_trait]
pub trait PagePrerenderer: Send + Sync {
fn page_type(&self) -> &str;
async fn prepare(&self, ctx: &dyn PrerendererContext) -> Result<Option<PageRenderSpec>>;
fn priority(&self) -> u32;
}
| Prerenderer | Output |
|---|---|
HomepagePrerenderer | /index.html |
FeaturePagePrerenderer | /features/*.html |
| Rule | Rationale |
|---|---|
| Templates use Handlebars syntax | {{variable}}, {{#if}}, {{> partial}} |
Partials embedded via include_str!() | Compile-time inclusion |
| Extension priority starts at 100 | Core uses 1-50 |
| Escape all user content | {{variable}} auto-escapes. {{{raw}}} only for trusted HTML. |
| CSS/JS paths via template variables | Never hardcode paths |
All renderers are Send + Sync | Multi-threaded async context |