vibe.document_generation

Final Document Rendering Logic.

render_final_document

render_final_document(template: TemplateData, context: NestedValue) -> tuple[bytes | str, str, str]

Render the final document (Docx or HTML from Markdown).

Parameters:
  • template (TemplateData) –

    The TemplateData object.

  • context (NestedValue) –

    The final NestedValue context containing all answers.

Returns:
  • bytes | str

    A tuple containing:

  • str
    • The rendered content (bytes for Docx, str for HTML).
  • str
    • The appropriate MIME type string.
Raises:
  • RuntimeError

    If rendering fails or template objects are missing.