Expand description
§systemprompt-templates
Template registry, loading, and rendering for systemprompt.io. The crate exposes:
TemplateRegistry— Handlebars-backed engine with multi-source template discovery, partial registration, and stat reporting. Registers ajsonhelper for emitting values inside JSON contexts (e.g. JSON-LD<script>blocks):{{{json field}}}serialises viaserde_json::to_string, which correctly escapes backslashes, newlines, and control characters that Handlebars’ default HTML escaping leaves intact.TemplateRegistryBuilder— fluent builder that wires together loaders, providers, and partial sources.CoreTemplateProvider— filesystem provider scanning a directory for.htmltemplates plus an optionaltemplates.yamlmanifest.EmbeddedDefaultsProvider— bundles the in-treedefaults/templates so consumers get a usable engine without touching disk.- Re-exports of the
systemprompt-template-providertraits the engine composes against.
§Feature flags
| Feature | Default | Effect |
|---|---|---|
| none | n/a | The crate exposes a single feature surface; all modules are compiled unconditionally. The [package.metadata.docs.rs] all-features = true setting is retained so future feature additions automatically appear in published docs. |
§Layering
systemprompt-templates is a domain crate whose only systemprompt
dependency is the systemprompt-template-provider shared crate.
Re-exports§
pub use error::TemplateError;pub use error::TemplateResult;
Modules§
- error
- Typed error surface for the templates crate.
Structs§
- Component
Context - Core
Template Provider - Embedded
Defaults Provider - Embedded
Loader - Extended
Data - Extender
Context - File
System Loader - Page
Context - Registry
Stats - Rendered
Component - Template
Definition - Template
Registry - Template
Registry Builder
Enums§
Traits§
- Component
Renderer - Page
Data Provider - Template
Data Extender - Template
Loader #[async_trait]is required: this trait is consumed asArc<dyn TemplateLoader>(seeDynTemplateLoader), so it must bedyn-compatible — nativeasync fnin traits is not.- Template
Provider