Skip to content

common_reports.builders.renderers.page

Modern interactive page — the branded, standalone report file.

InteractiveHtmlRenderer(style="modern") builds this from the same Document and the same building blocks as the modern email, laid out for a browser: a contents sidebar, sections that fold (collapsible=True), live Plotly charts (hover and zoom per PlotFormat.hover / .zoom) and dark mode that follows the reader’s system. Everything is inside the one file: images are data URIs.

plotly="cdn" (default) loads plotly.js from Plotly’s CDN and puts a static image under every chart, shown whenever the library cannot load (offline, mail attachment previews). plotly="inline" embeds plotly.js instead: charts work anywhere, at about 4.6 MB more per file, and no static images are rendered.

Classes

ModernPageRenderer

Bases: ModernBlocks, InteractiveHtmlRenderer

The branded interactive page. Build it as InteractiveHtmlRenderer(style="modern").

brand as for the modern email (default NULL_CAPITAL); plotly is "cdn" or "inline" (see the module notes). Charts are see-through so they read on the light and the dark page.

Carried state (reset by each render): as for the modern email blocks, plus the rendered figure assets.

__init__

def __init__(*, theme: Theme | None = None, title: str | None = None, date: str | None = None, style: str = 'modern', brand: Brand | None = NULL_CAPITAL, plotly: str = 'cdn', **kw: Any) -> None

Fields and properties declared here; inherited members belong to the bases above.

modern_view

modern_view = True

target

target = Target.INTERACTIVE

finalize

def finalize(document: Document, body: str) -> RenderResult

visit_figure

def visit_figure(node: Figure) -> str

visit_section

def visit_section(node: Section) -> str