MODULE

MKAPI.CORE.RENDERER

This module provides Renderer class that renders Node instance to create API documentation.

Attributes
  • renderer (Renderer) Renderer instance that can be used globally.
Classes
  • Renderer Renderer instance renders Node instance recursively to create API documentation.</>
dataclass

mkapi.core.renderer.Renderer()

Renderer instance renders Node instance recursively to create API documentation.

Attributes
  • templates (dict(str: Template)) Jinja template dictionary.
Methods
  • render(node, filters) (str) Returns a rendered HTML for Node.</>
  • render_docstring(docstring, filters) (str) Returns a rendered HTML for Docstring.</>
  • render_module(module, filters) (str) Returns a rendered Markdown for Module.</>
  • render_node(node, object, docstring, members) (str) Returns a rendered HTML for Node using prerendered components.</>
  • render_object(object, filters) (str) Returns a rendered HTML for Object.</>
  • render_object_member(name, url, signature) (str) Returns a rendered HTML for Object in toc.</>
  • render_section(section, filters) (str) Returns a rendered HTML for Section.</>
method

render(node, filters=None) → str

Returns a rendered HTML for Node.

Parameters
  • node (Node) Node instance.
  • filters (list of str, optional)
method

render_node(node, object, docstring, members) → str

Returns a rendered HTML for Node using prerendered components.

Parameters
  • node (Node) Node instance.
  • object (str) Rendered HTML for Object instance.
  • docstring (str) Rendered HTML for Docstring instance.
  • members (list of str) A list of rendered HTML for member Node instances.
method

render_object(object, filters=None) → str

Returns a rendered HTML for Object.

Parameters
  • object (Object) Object instance.
  • filters (list of str, optional) Filters.
method

render_object_member(name, url, signature) → str

Returns a rendered HTML for Object in toc.

Parameters
  • name (str) Object name.
  • url (str) Link to definition.
  • signature (dict(str: any)) Signature.
method

render_docstring(docstring, filters=None) → str

Returns a rendered HTML for Docstring.

Parameters
  • docstring (Docstring) Docstring instance.
  • filters (list of str, optional)
method

render_section(section, filters=None) → str

Returns a rendered HTML for Section.

Parameters
  • section (Section) Section instance.
  • filters (list of str, optional)
method

render_module(module, filters=None) → str

Returns a rendered Markdown for Module.

Parameters
  • module (Module) Module instance.
  • filters (list of str, optional) A list of filters. Avaiable filters: upper, inherit, strict, heading.

Note

This function returns Markdown instead of HTML. The returned Markdown will be converted into HTML by MkDocs. Then the HTML is rendered into HTML again by other functions in this module.