From a808f1c096706c6f9013236b5afb4803a659c40e Mon Sep 17 00:00:00 2001 From: Neil Campbell Date: Thu, 18 Sep 2025 01:11:48 +0800 Subject: [PATCH] docs: fix image path --- docs/markdown/capabilities/app-deploy.md | 2 +- docs/source/conf.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/markdown/capabilities/app-deploy.md b/docs/markdown/capabilities/app-deploy.md index a64bb8a6..1363162d 100644 --- a/docs/markdown/capabilities/app-deploy.md +++ b/docs/markdown/capabilities/app-deploy.md @@ -26,7 +26,7 @@ Namely, it described the concept of a smart contract development lifecycle: 1. **Validate** the deployed app via automated testing of the smart contracts to provide confidence in their correctness 2. **Call** deployed smart contract with runtime parameters to utilise it -![App deployment lifecycle](images/lifecycle.jpg) +![App deployment lifecycle](../images/lifecycle.jpg) The App deployment capability provided by AlgoKit Utils helps implement **#2 Deployment**. diff --git a/docs/source/conf.py b/docs/source/conf.py index b7441f65..492b0888 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -65,6 +65,7 @@ import os import shutil from pathlib import Path +from docutils import nodes def copy_images_for_markdown(app, exception): """Copy images from source/images to markdown/images for markdown builds.""" @@ -82,9 +83,21 @@ def copy_images_for_markdown(app, exception): shutil.copy2(image_file, dest_images / image_file.name) print(f"Copied {image_file.name} to {dest_images}") +def fix_image_paths_in_doctree(app, doctree, docname): + """Fix image paths in doctree to preserve relative paths for markdown output.""" + if app.builder.name == 'markdown': + for node in doctree.traverse(nodes.image): + if 'uri' in node: + uri = node['uri'] + # If the URI was resolved from ../images/ to images/, change it back + if uri.startswith('images/') and not uri.startswith('../'): + node['uri'] = '../' + uri + print(f"Fixed image path: {uri} -> {node['uri']}") + def setup(app): """Sphinx extension setup function.""" app.connect('build-finished', copy_images_for_markdown) + app.connect('doctree-resolved', fix_image_paths_in_doctree) return { 'version': '1.0', 'parallel_read_safe': True,