Skip to main content

default_render

Function default_render 

Source
pub fn default_render<B: Block + ?Sized>(
    block: &B,
    value: &Value,
    ctx: &BlockRenderCtx<'_>,
) -> Result<String, BlockError>
Expand description

Walk a block’s fields and render its template.

Template lookup precedence:

  1. block.template() if it returns Some(path).
  2. Otherwise blocks/<type_name>.html.

The rendered template receives the following Tera context:

  • value: the block’s whole value dict (mirrors what authors actually want — addressing fields by name as {{ value.heading }}).
  • block_type: the wire type_name.
  • Every crate::block::BlockField::Computed field’s render output as computed.<field_name> so templates can pull derived chips inline.

§Errors

BlockError::TemplateRender on Tera failure; BlockError::Shape when the block value isn’t an object (the only shape the field walker accepts).