From 22a0a39d811de2df353956b8963657af86498ccd Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Thu, 3 Jul 2025 02:05:45 -0400 Subject: [PATCH] implement markdown.image_labels config option --- src/zona/config.py | 2 +- src/zona/markdown.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/zona/config.py b/src/zona/config.py index 90b1488..9237637 100644 --- a/src/zona/config.py +++ b/src/zona/config.py @@ -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 diff --git a/src/zona/markdown.py b/src/zona/markdown.py index 94c2015..d2cf4e5 100644 --- a/src/zona/markdown.py +++ b/src/zona/markdown.py @@ -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 ""