docs.plugin

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

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…

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.

docs.plugin

Name Type Default Description
type
qualified_name
element_type
description
source_file
line_number
is_autodoc
autodoc_element
_autodoc_template
_autodoc_url_path
_autodoc_page_type
title
doc_content_hash

Symbols on this page

_block_body_text
function
def _block_body_text(html: object, max_len: int = _BLOCK_BODY_MAX) -> str

Strip tags + collapse whitespace for plain-text block-match scoring.

Parameters

Name Type Default Description
html object
max_len int _BLOCK_BODY_MAX
_CollectionHolder
class

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.

DocsPlugin
class

Serve markdown documentation as first-class Chirp pages.

View source · /home/runner/work/chirp/chirp/site/../src/chirp/docs/plugin.py:1