Module

docs.plugin

DocsPlugin — mount documentation as browsable pages at any URL prefix.

Usage::

from chirp.docs import DocsPlugin

app.mount("/docs", DocsPlugin(content_dir="./content/docs"))

Registers routes for the index and individual doc pages, a template loader for default templates, the markdown filter, and a nav template global. Fragment navigation works automatically viaPage.

Whenautodoc=True, a startup hook introspects the frozen app and merges auto-generated API reference pages into the collection.

Whensuspense=True, doc page routes use Suspense rendering — the shell (sidebar, nav) renders immediately and the content block streams in via OOB swap.

Classes

_CollectionHolder 1
Mutable wrapper so startup hook can replace the collection. Route closures capture this holder — w…

Mutable wrapper so startup hook can replace the collection.

Route closures capture this holder — when autodoc merges pages, the updated collection is visible to subsequent requests.

Methods

Internal Methods 1
__init__ 1
def __init__(self, collection: DocsCollection) -> None
Parameters
Name Type Description
collection
DocsPlugin 2
Serve markdown documentation as first-class Chirp pages.

Serve markdown documentation as first-class Chirp pages.

Methods

register 2
Wire routes, templates, filters, and globals into the app.
def register(self, app: App, prefix: str) -> None
Parameters
Name Type Description
app
prefix
Internal Methods 1
__init__ 6
def __init__(self, content_dir: str | Path, *, title: str = 'Documentation', include_drafts: bool = False, autodoc: bool = True, tools: bool = True, suspense: bool = False) -> None
Parameters
Name Type Description
content_dir
title Default:'Documentation'
include_drafts Default:False
autodoc Default:True
tools Default:True
suspense Default:False

Functions

_block_body_text 2 str
Strip tags + collapse whitespace for plain-text block-match scoring.
def _block_body_text(html: object, max_len: int = _BLOCK_BODY_MAX) -> str
Parameters
Name Type Description
html object
max_len int Default:_BLOCK_BODY_MAX
Returns
str