Skip to main content

rendering.BaseRenderer

The common base of object, page and section renderers

Usage

Source

rendering.BaseRenderer(
    node,
    level=1,
    *,
    renderers=_default_renderers(),
    extension=_default_extension(),
    context_page_path=None,
)

An object renderer renders a heading and a docstring; a page renderer renders front matter and the objects on the page; a section renderer renders linked summaries. Each renderer renders its title, description, body and summary once and caches them. To change one, override the matching render_* method, and return None from a method that renders a block to omit that block.

Parameter Attributes

node: (
    APIReference
    | content.DocClass
    | content.DocFunction
    | content.DocAttribute
    | content.DocTypeAlias
    | content.DocModule
    | content.Page
    | content.Section
)

The node being documented

level: int = 1

The heading depth of this appearance

renderers: Renderers = _default_renderers()

Renderer choices shared with nested objects, pages and summaries

extension: Extension = _default_extension()

The extension that supplies settings and project directories

A standalone renderer uses default settings and has no project directories.

context_page_path: str | None = None
The containing page’s path relative to the output directory, apart from summary links

Attributes

Name Description
output_root The directory the documentation is generated into, or None outside a build
settings The settings of the API reference being rendered
summary_name The label in linked summaries, which the base renderer leaves empty

Functions

Name Description
__post_init__() End the chain of super().__post_init__() calls from subclasses and mixins
__str__() Compose the cached title, description and body as Quarto Markdown
body() The body, rendered once per renderer and cached
description() The description, rendered once per renderer and cached
make_renderer() Construct a nested renderer with this renderer’s choices and context
render_body() Render the body, or return None to omit it
render_description() Render the description, or return None to omit it
render_summary() Render linked summary items, or return an empty sequence to omit them
render_title() Render an object’s heading or a page’s front matter, or return None to omit it
summary() The linked summary items, rendered once per renderer and cached
title() The title, rendered once per renderer and cached