Skip to main content

rendering.ObjectRenderer

The presentation of one prepared Python object or authored alias

Usage

Source

rendering.ObjectRenderer(
    node,
    level=1,
    contained=False,
    page_path=None,
    display_name_format="doc",
    signature_name_format="doc",
    *,
    renderers=_default_renderers(),
    extension=_default_extension(),
    context_page_path=None,
    _purpose=_RenderingPurpose.OBJECT,
)

The heading, lead content and body each have their own render method. Each object kind sets the order of its signature and subject, and kinds with members add member groups after the object’s own docstring. Use context to customise a particular appearance.

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

contained: bool = False

Whether this object is documented inside another object’s documentation

A contained member’s summary row links to its heading on the same page, and its context reports the containing page.

page_path: str | None = None

The page that this object’s summary row links to

API pages supply a path relative to the reference directory. None links within the current page, and contained members always link to a local anchor. For the containing page relative to the output directory, use context.page_path.

display_name_format: DisplayNameFormat = "doc"

Format for the display name

signature_name_format: DisplayNameFormat = "doc"

Format for the signature name

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

_purpose: _RenderingPurpose = _RenderingPurpose.OBJECT

Attributes

Name Description
summary_name The authored name shown in this object’s summary row

Functions

Name Description
__post_init__() Expose the documentation node as doc and its prepared Python object as obj
__str__() Include the published link target alongside the native heading ID
context() The frozen record of this object’s appearance
display_name() The Markdown-escaped name shown in the heading
docstring_sections() The rendered docstring sections, omitting empty ones
docstring_sections_content() The title and prepared section of each docstring section after the subject
docstring_subject() The first paragraph of the docstring, on one line, shown as the subject
kind() The object’s kind
kind_slug() The object’s kind as a CSS class slug
label() The lower-case kind label used in the CSS classes of headings and summary rows
render_admonition_section() Render the descriptive content of an additional numpydoc section
render_annotation() Render an annotation as highlighted inline content
render_body() Render the object’s docstring body
render_classes_section() Omit a hand-written Classes summary
render_definition_items() Render a section’s definitions with their names, annotations, defaults and descriptions
render_deprecated_section() Render a Deprecated section
render_description() Render the signature, the Usage and source row, and the subject, in that order
render_docstring_body() Render the docstring sections that follow the subject
render_docstring_section() Render one docstring section with the method for its kind
render_docstring_subject() Render the subject of the docstring
render_examples_section() Render an Examples section
render_functions_section() Omit hand-written Functions and Methods summaries
render_modules_section() Omit a hand-written Modules summary
render_notes_section() Render a Notes section
render_see_also_section() Render a See Also section
render_signature() Render the object declaration, or return None to omit it
render_summary() Render one summary row that links summary_name and shows the subject
render_text_section() Render a Text section
render_title() Render the heading that holds title_content, or return None to omit it
render_title_content() Render the object’s display name and labels as inline text
render_type_aliases_section() Omit a hand-written Type Aliases summary
render_usage_source() Render the Usage label and the source link, or None when neither applies
render_variable_definition() Render a variable or parameter declaration as inline markup
render_warnings_section() Render a Warnings section
signature() The signature from render_signature, cached once per renderer instance
signature_name() The name shown in the signature, formatted by signature_name_format
source_link() The link to the object’s source, or None without one
title_content() The object’s labelled name as inline text