Skip to content

Commit 16be976

Browse files
committed
docs: resolve broken image in md docs build
1 parent d9c994d commit 16be976

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

docs/markdown/images/lifecycle.jpg

122 KB
Loading

docs/source/conf.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,33 @@
6060
pygments_style = "sphinx"
6161
pygments_dark_style = "monokai"
6262
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
63+
64+
# Copy images for markdown build
65+
import os
66+
import shutil
67+
from pathlib import Path
68+
69+
def copy_images_for_markdown(app, exception):
70+
"""Copy images from source/images to markdown/images for markdown builds."""
71+
if app.builder.name == 'markdown':
72+
source_images = Path(app.srcdir) / 'images'
73+
dest_images = Path(app.outdir) / 'images'
74+
75+
if source_images.exists():
76+
# Ensure destination directory exists
77+
dest_images.mkdir(parents=True, exist_ok=True)
78+
79+
# Copy all image files
80+
for image_file in source_images.iterdir():
81+
if image_file.is_file() and image_file.suffix.lower() in ['.jpg', '.jpeg', '.png', '.gif', '.svg']:
82+
shutil.copy2(image_file, dest_images / image_file.name)
83+
print(f"Copied {image_file.name} to {dest_images}")
84+
85+
def setup(app):
86+
"""Sphinx extension setup function."""
87+
app.connect('build-finished', copy_images_for_markdown)
88+
return {
89+
'version': '1.0',
90+
'parallel_read_safe': True,
91+
'parallel_write_safe': True,
92+
}

0 commit comments

Comments
 (0)