Module

rendering.pipeline.transforms

Content transformation utilities for rendering pipeline.

Provides HTML transformations including template syntax escaping, link transformation, and Jinja2 block escaping.

Related Modules:

  • bengal.rendering.pipeline.core: Uses these transformations
  • bengal.rendering.link_transformer: Link transformation implementation

Functions

escape_template_syntax_in_html
Escape Jinja2 variable delimiters in already-rendered HTML. Converts "{{" and "}}" to HTML entitie…
1 str
def escape_template_syntax_in_html(html: str) -> str

Escape Jinja2 variable delimiters in already-rendered HTML.

Converts "{{" and "}}" to HTML entities so they appear literally in documentation pages but won't be detected by tests as unrendered.

Parameters 1

Name Type Default Description
html str

HTML content to escape

Returns

str

HTML with escaped template syntax

escape_jinja_blocks
Escape Jinja2 block delimiters in already-rendered HTML content. Converts "{%" and "%}" to HTML en…
1 str
def escape_jinja_blocks(html: str) -> str

Escape Jinja2 block delimiters in already-rendered HTML content.

Converts "{%" and "%}" to HTML entities to avoid leaking raw control-flow markers into final HTML outside template processing.

Parameters 1

Name Type Default Description
html str

HTML content to escape

Returns

str

HTML with escaped Jinja2 blocks

transform_internal_links
Transform internal links to include baseurl prefix. This handles standard markdown links like [tex…
2 str
def transform_internal_links(html: str, config: dict[str, Any]) -> str

Transform internal links to include baseurl prefix.

This handles standard markdown links like text by prepending the configured baseurl. Essential for GitHub Pages project sites and similar deployments where the site is not at the domain root.

Parameters 2

Name Type Default Description
html str

Rendered HTML content

config dict[str, Any]

Site configuration dict

Returns

str

HTML with transformed internal links