Skip to content

Renderers

docforge.renderers

Renderers Layer

The docforge.renderers package handles the transformation of the internal documentation models into physical files formatted for specific documentation engines.

Current Implementations

  • MkDocsRenderer: Generates Markdown files utilizing the mkdocstrings syntax. It automatically handles package/module hierarchy and generates index.md files for packages.

Extending

To add a new renderer, implement the DocRenderer protocol defined in docforge.renderers.base.

MCPRenderer

Renderer that emits MCP-native JSON resources from docforge models.

generate_sources

generate_sources(project: Project, out_dir: Path) -> None

Generate MCP-compatible JSON resources and navigation for the project.

Parameters:

Name Type Description Default
project Project

The project model to render.

required
out_dir Path

Target directory for the generated JSON files.

required

MkDocsRenderer

Renderer that generates Markdown source files formatted for the MkDocs 'mkdocstrings' plugin.

generate_sources

generate_sources(project: Project, out_dir: Path) -> None

Produce a set of Markdown files in the output directory based on the provided Project models.

Parameters:

Name Type Description Default
project Project

The project models to render.

required
out_dir Path

Target directory for documentation files.

required