implement markdown.image_labels config option

This commit is contained in:
Daniel Fichtinger 2025-07-03 02:05:45 -04:00
parent 0940472410
commit 22a0a39d81
2 changed files with 4 additions and 1 deletions

View file

@ -54,7 +54,7 @@ class ZonaConfig:
# list of globs relative to content that should be ignored
ignore: list[str] = field(default_factory=lambda: IGNORELIST)
markdown: MarkdownConfig = field(default_factory=MarkdownConfig)
build: BuildConfig = field(default_factory=BuildConfig)
# build: BuildConfig = field(default_factory=BuildConfig)
blog: BlogConfig = field(default_factory=BlogConfig)
@classmethod

View file

@ -72,6 +72,9 @@ class ZonaRenderer(HTMLRenderer):
# TODO: image compression/dithering?
@override
def render_image(self, element: Image):
assert self.config
if not self.config.markdown.image_labels:
return super().render_image(element)
# get label text from children
text = self.render_children(element)
title = element.title or ""