Module

rendering.metadata

Metadata utilities for build information and template metadata.

Provides functions for generating build metadata including version information, markdown engine details, syntax highlighter versions, and theme information. Used for template metadata generation and build information reporting.

Key Concepts:

  • Build metadata: Version information for Bengal and dependencies
  • Markdown engine detection: Resolves configured markdown parser and version
  • Syntax highlighter detection: Pygments version detection
  • Theme information: Theme name and version from theme packages

Related Modules:

  • bengal.utils.theme_registry: Theme package lookup
  • bengal.rendering.template_engine: Template engine using metadata
  • bengal.utils.build_stats: Build statistics collection

See Also:

  • bengal/utils/metadata.py:build_template_metadata() for metadata generation

Functions

_get_markdown_engine_and_version 1 tuple[str, str | None]
Determine configured markdown engine and resolve its library version.
def _get_markdown_engine_and_version(config: dict[str, Any]) -> tuple[str, str | None]
Parameters
Name Type Description
config dict[str, Any]
Returns
tuple[str, str | None]
_get_capabilities 0 dict[str, bool]
Detect runtime capabilities based on installed optional dependencies. These ar…
def _get_capabilities() -> dict[str, bool]

Detect runtime capabilities based on installed optional dependencies.

These are checked once at build time and cached. Templates can use these to conditionally enable features (e.g., only emit search-index.json meta tag when lunr is installed and will generate the pre-built index).

Returns
dict[str, bool]
build_template_metadata 1 dict[str, Any]
Build a curated, privacy-aware metadata dictionary for templates/JS. Exposure …
def build_template_metadata(site: SiteLike) -> dict[str, Any]

Build a curated, privacy-aware metadata dictionary for templates/JS.

Exposure levels (via config['expose_metadata']):

  • minimal: engine only
  • standard: + theme, build timestamp, i18n basics
  • extended: + rendering details (markdown/highlighter versions)
Parameters
Name Type Description
site SiteLike
Returns
dict[str, Any]