@@ -162,8 +162,15 @@ jobs:
162162 grep "images/" "$slidev_dir/step2.md" || echo "No images found"
163163
164164 # Normalize all image paths and handle missing images
165- # First, normalize existing images to ./images/filename
166- sed 's|!\[\([^]]*\)\](\([^/]*/\)*\([^/)]*\.\(png\|jpg\|jpeg\|gif\|svg\|webp\))\)||g; s|image: \([^/]*/\)*\([^/]*\.\(png\|jpg\|jpeg\|gif\|svg\|webp\)\)|image: ./images/\2|g' "$slidev_dir/step2.md" > "$slidev_dir/step3_temp.md"
165+ echo "=== Before image path normalization ==="
166+ grep -n "images/" "$slidev_dir/step2.md" || echo "No image references found in step2.md"
167+
168+ # First, normalize existing images to ./images/filename using simpler sed
169+ # Handle common patterns one by one to be more reliable
170+ sed 's|../images/|./images/|g; s|/images/|./images/|g' "$slidev_dir/step2.md" > "$slidev_dir/step3_temp.md"
171+
172+ echo "=== After basic path normalization ==="
173+ grep -n "images/" "$slidev_dir/step3_temp.md" || echo "No image references found after basic normalization"
167174
168175 # Then, replace references to missing images with error messages
169176 while IFS= read -r line; do
@@ -174,6 +181,7 @@ jobs:
174181 # Image is missing, replace with error message
175182 alt_text=$(echo "$line" | sed -n 's/.*!\[\([^]]*\)\].*/\1/p')
176183 echo "$line" | sed "s|!\[.*\](./images/.*)|**🚫 MISSING IMAGE: $img_file** *(was: $alt_text)*|g"
184+ echo "Replaced missing image reference: $img_file"
177185 else
178186 echo "$line"
179187 fi
@@ -184,6 +192,7 @@ jobs:
184192 # Image is missing, comment out the line and add error
185193 echo "# MISSING IMAGE: $img_file"
186194 echo "# $line"
195+ echo "Commented out missing YAML image: $img_file"
187196 else
188197 echo "$line"
189198 fi
@@ -192,6 +201,9 @@ jobs:
192201 fi
193202 done < "$slidev_dir/step3_temp.md" > "$slidev_dir/step3.md"
194203
204+ echo "=== After missing image handling ==="
205+ grep -n "images/" "$slidev_dir/step3.md" || echo "No image references found in final step3.md"
206+
195207 # Clean up temp file
196208 rm -f "$slidev_dir/step3_temp.md"
197209 echo "=== Step 3 - After image path conversion ==="
@@ -203,7 +215,12 @@ jobs:
203215 rm -f "$slidev_dir/step1.md" "$slidev_dir/step2.md" "$slidev_dir/step3.md"
204216
205217 echo "=== Final slides.md content (image references) ==="
206- grep -n "images/" "$slidev_dir/slides.md" || echo "No image references found"
218+ echo "All image references in final slides.md:"
219+ grep -n "images/" "$slidev_dir/slides.md" || echo "No image references found in final slides.md"
220+ echo "Checking for any remaining ../images/ references:"
221+ grep -n "\.\./images/" "$slidev_dir/slides.md" && echo "⚠️ WARNING: Found unreplaced ../images/ references!" || echo "✅ No ../images/ references found"
222+ echo "Files in images directory:"
223+ ls -la "$slidev_dir/images/" || echo "No images directory found"
207224
208225 echo "=== Complete slides.md content ==="
209226 echo "--- START OF slides.md ---"
0 commit comments