Module

utils.autodoc

Utilities for detecting autodoc-generated content.

Provides a canonical implementation for detecting whether a page was generated by Bengal's autodoc system. This consolidates duplicate implementations found in:

  • bengal/analysis/knowledge_graph.py (_is_autodoc_page)
  • bengal/health/validators/directives.py (_is_autodoc_file)

See RFC: plan/active/rfc-code-quality-improvements.md

Functions

is_autodoc_page
Check if a page is autodoc-generated. Autodoc pages are identified by multiple signals: **Frontma…
1 bool
def is_autodoc_page(page: Page | Any) -> bool

Check if a page is autodoc-generated.

Autodoc pages are identified by multiple signals:

Frontmatter Indicators:

  • Type starting with "python-" (python-module, python-class, etc.)
  • Type "cli-reference" or "api-reference"
  • Presence of "source_file" field
  • Generator metadata "bengal-autodoc"
  • Presence of "_api_doc" marker

Content Indicators:

  • Content containing "Generated by Bengal autodoc"
  • Content containing "Generated by Bengal"

Path Indicators:

  • Source path contains "/api/"
  • Source path ends with "/api"

Parameters 1

Name Type Default Description
page Page | Any

Page object to check. Can be a Page, PageProxy, or any object with metadata/frontmatter and content attributes.

Returns

bool

True if page is autodoc-generated