From 9f5b6eaa8feed92b4dcb0e4dc90f70a46c401e21 Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Wed, 15 Apr 2026 12:17:28 +0300 Subject: fix: configure Sphinx to prefer WebP for HTML output Sphinx 7.2.x does not include image/webp in the HTML builder default supported_image_types, so wildcard references resolved to PNG. Patch the priority list so HTML builds select WebP while LaTeX stays unaffected. Co-Authored-By: Claude Opus 4.6 (1M context) --- docs/conf.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index e87def82..b2c871c5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -199,4 +199,12 @@ texinfo_documents = [ def setup(app): - pass \ No newline at end of file + # Prefer WebP for HTML output; LaTeX keeps its default (PDF/PNG/JPEG) + from sphinx.builders.html import StandaloneHTMLBuilder + StandaloneHTMLBuilder.supported_image_types = [ + 'image/webp', + 'image/svg+xml', + 'image/png', + 'image/gif', + 'image/jpeg', + ] \ No newline at end of file -- cgit v1.2.3 From 278fe418cf3cc5b9889bd1f9973a417a3560796f Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Wed, 15 Apr 2026 12:23:25 +0300 Subject: fix: also patch DirectoryHTMLBuilder for WebP priority ReadTheDocs uses a builder that subclasses DirectoryHTMLBuilder, not StandaloneHTMLBuilder. Patch both to ensure WebP is preferred in all HTML build variants. Co-Authored-By: Claude Opus 4.6 (1M context) --- docs/conf.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index b2c871c5..eacec2c7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -200,11 +200,14 @@ texinfo_documents = [ def setup(app): # Prefer WebP for HTML output; LaTeX keeps its default (PDF/PNG/JPEG) - from sphinx.builders.html import StandaloneHTMLBuilder - StandaloneHTMLBuilder.supported_image_types = [ + webp_types = [ 'image/webp', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', - ] \ No newline at end of file + ] + from sphinx.builders.html import StandaloneHTMLBuilder + StandaloneHTMLBuilder.supported_image_types = webp_types + from sphinx.builders.dirhtml import DirectoryHTMLBuilder + DirectoryHTMLBuilder.supported_image_types = webp_types \ No newline at end of file -- cgit v1.2.3 From 2ff3232cac2278f22624a0a2e8daf2280b14912c Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Wed, 15 Apr 2026 12:31:26 +0300 Subject: refactor: use builder-inited hook for WebP image type override Replaces class-level patching of StandaloneHTMLBuilder/DirectoryHTMLBuilder with a builder-inited event hook that only modifies html, dirhtml, and readthedocs builders. This avoids unintentionally affecting EPUB or HTMLHelp builders that inherit from StandaloneHTMLBuilder. Co-Authored-By: Claude Opus 4.6 (1M context) --- docs/conf.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index eacec2c7..dc24ba85 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -198,16 +198,17 @@ texinfo_documents = [ ] +def _prefer_webp(app): + """Add WebP to front of supported types for HTML/dirhtml builders only.""" + if app.builder.name in ('html', 'dirhtml', 'readthedocs'): + app.builder.supported_image_types = [ + 'image/webp', + 'image/svg+xml', + 'image/png', + 'image/gif', + 'image/jpeg', + ] + + def setup(app): - # Prefer WebP for HTML output; LaTeX keeps its default (PDF/PNG/JPEG) - webp_types = [ - 'image/webp', - 'image/svg+xml', - 'image/png', - 'image/gif', - 'image/jpeg', - ] - from sphinx.builders.html import StandaloneHTMLBuilder - StandaloneHTMLBuilder.supported_image_types = webp_types - from sphinx.builders.dirhtml import DirectoryHTMLBuilder - DirectoryHTMLBuilder.supported_image_types = webp_types \ No newline at end of file + app.connect('builder-inited', _prefer_webp) -- cgit v1.2.3 From 296b2d226b547ba2e5359cbf40f9d3f76e5fcd95 Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Wed, 15 Apr 2026 12:46:31 +0300 Subject: fix: prepend WebP to existing supported_image_types instead of replacing Avoids dropping types that Sphinx or themes may add in future versions. Deduplicates if WebP is already present. Co-Authored-By: Claude Opus 4.6 (1M context) --- docs/conf.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index 7f302ceb..ec1827ca 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -210,15 +210,11 @@ texinfo_documents = [ def _prefer_webp(app): - """Add WebP to front of supported types for HTML/dirhtml builders only.""" + """Prepend WebP to supported image types for HTML builders.""" if app.builder.name in ('html', 'dirhtml', 'readthedocs'): - app.builder.supported_image_types = [ - 'image/webp', - 'image/svg+xml', - 'image/png', - 'image/gif', - 'image/jpeg', - ] + types = app.builder.supported_image_types + if 'image/webp' not in types: + app.builder.supported_image_types = ['image/webp'] + types def setup(app): -- cgit v1.2.3 From abc3e9d38f8ce56fd73cd2007b96152fcbd083a2 Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Thu, 23 Apr 2026 11:08:21 +0300 Subject: perf: use vyos-logo.webp for html_logo in conf.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The WebP logo file was added by this PR but not consumed by anything since html_logo still pointed to the .png. Sphinx serves html_logo as an tag with full WebP browser support. html_favicon stays .png (WebP favicon support is inconsistent in some environments). latex_logo stays .png (LaTeX does not support WebP). 🤖 Generated by [robots](https://vyos.io) --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index ec1827ca..1c1014e0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -134,7 +134,7 @@ llms_txt_file = False # The name of an image file (relative to this directory) to place at the top # of the sidebar. -html_logo = '_static/images/vyos-logo.png' +html_logo = '_static/images/vyos-logo.webp' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -- cgit v1.2.3