Module

utils.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
Determine configured markdown engine and resolve its library version.
1 tuple[str, str | None]
def _get_markdown_engine_and_version(config: dict[str, Any]) -> tuple[str, str | None]

Determine configured markdown engine and resolve its library version.

Parameters 1

Name Type Default Description
config dict[str, Any]

Returns

tuple[str, str | None]

build_template_metadata
Build a curated, privacy-aware metadata dictionary for templates/JS. Exposure levels (via config['…
1 dict[str, Any]
def build_template_metadata(site: Site) -> 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 1

Name Type Default Description
site Site

Returns

dict[str, Any]