Skip to content

Commit b7cd135

Browse files
future-xyclaude
andcommitted
fix: migrate to asset colocation for versioned documentation images
- Update image paths to use require() syntax for Docusaurus - Images now stay in docs/images/ and versioned_docs/*/images/ - Prevents cross-version image conflicts - Add verification script to check image paths Changes: - docs/intro.md: Use require('./images/serverlessllm.jpg').default - versioned_docs/*/intro.md: Use require('./images/serverlessllm.jpg').default - All README.md files: Update documentation with require() syntax examples - verify-image-paths.sh: Script to validate image references 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0acf129 commit b7cd135

File tree

7 files changed

+110
-12
lines changed

7 files changed

+110
-12
lines changed

docs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ Images are stored in the `images` directory alongside the documentation files. T
4444

4545
**Examples:**
4646
```markdown
47-
<!-- Markdown syntax -->
47+
<!-- Markdown syntax (no width control) -->
4848
![Alt text](./images/a.jpg)
4949

50-
<!-- HTML syntax with sizing -->
51-
<img src="./images/a.jpg" alt="Description" width="256px"/>
50+
<!-- HTML syntax with sizing (use require for Docusaurus) -->
51+
<img src={require('./images/a.jpg').default} alt="Description" width="256px"/>
5252
```
5353

5454
When you create a new documentation version using `npm run docusaurus docs:version X.X.X`, the images directory is automatically copied with the versioned docs.

docs/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_position: 0
55
# Serverless LLM
66

77
<!-- Scaled logo -->
8-
<img src="./images/serverlessllm.jpg" alt="ServerlessLLM" width="256px"/>
8+
<img src={require('./images/serverlessllm.jpg').default} alt="ServerlessLLM" width="256px"/>
99

1010
ServerlessLLM is a **fast** and **easy-to-use** serving system designed for **affordable** multi-LLM serving, also known as LLM-as-a-Service. ServerlessLLM is ideal for environments with multiple LLMs that need to be served on limited GPU resources, as it enables efficient dynamic loading of LLMs onto GPUs. By elastically scaling model instances and multiplexing GPUs, ServerlessLLM can significantly reduce costs compared to traditional GPU-dedicated serving systems while still providing low-latency (Time-to-First-Token, TTFT) LLM completions.
1111

verify-image-paths.sh

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/bin/bash
2+
3+
# Color codes for output
4+
RED='\033[0;31m'
5+
GREEN='\033[0;32m'
6+
YELLOW='\033[1;33m'
7+
NC='\033[0m' # No Color
8+
9+
echo "================================================"
10+
echo "Image Path Verification Script"
11+
echo "================================================"
12+
echo ""
13+
14+
# 1. Check for remaining /img/ references in markdown files
15+
echo "1. Checking for old /img/ references..."
16+
OLD_REFS=$(grep -r "/img/" --include="*.md" --include="*.mdx" docs/ versioned_docs/ 2>/dev/null | grep -v "node_modules" | grep -v ".git" || true)
17+
18+
if [ -z "$OLD_REFS" ]; then
19+
echo -e "${GREEN}✓ No old /img/ references found${NC}"
20+
else
21+
echo -e "${RED}✗ Found old /img/ references:${NC}"
22+
echo "$OLD_REFS"
23+
echo ""
24+
fi
25+
26+
# 2. Check for relative image paths and verify files exist
27+
echo ""
28+
echo "2. Verifying relative image paths..."
29+
BROKEN_IMAGES=0
30+
VALID_IMAGES=0
31+
32+
# Find all image references with relative paths
33+
while IFS= read -r line; do
34+
# Extract file path and line content
35+
FILE=$(echo "$line" | cut -d: -f1)
36+
CONTENT=$(echo "$line" | cut -d: -f2-)
37+
38+
# Extract image path from markdown ![](path) or <img src="path"
39+
IMAGE_PATH=$(echo "$CONTENT" | grep -oP '(?<=\()\./images/[^)]+(?=\))' || echo "$CONTENT" | grep -oP '(?<=src=")[^"]+(?=")' || true)
40+
41+
if [ -n "$IMAGE_PATH" ]; then
42+
# Resolve relative path
43+
DIR=$(dirname "$FILE")
44+
FULL_PATH="$DIR/$IMAGE_PATH"
45+
46+
if [ -f "$FULL_PATH" ]; then
47+
((VALID_IMAGES++))
48+
else
49+
echo -e "${RED}✗ Broken image reference:${NC}"
50+
echo " File: $FILE"
51+
echo " References: $IMAGE_PATH"
52+
echo " Expected at: $FULL_PATH"
53+
echo ""
54+
((BROKEN_IMAGES++))
55+
fi
56+
fi
57+
done < <(grep -r "\./images/" --include="*.md" --include="*.mdx" docs/ versioned_docs/ 2>/dev/null | grep -v "node_modules" | grep -v ".git" || true)
58+
59+
echo -e "${GREEN}✓ Valid image references: $VALID_IMAGES${NC}"
60+
if [ $BROKEN_IMAGES -gt 0 ]; then
61+
echo -e "${RED}✗ Broken image references: $BROKEN_IMAGES${NC}"
62+
else
63+
echo -e "${GREEN}✓ No broken image references${NC}"
64+
fi
65+
66+
# 3. List all images in version directories
67+
echo ""
68+
echo "3. Image inventory:"
69+
for dir in docs/images versioned_docs/*/images; do
70+
if [ -d "$dir" ]; then
71+
count=$(find "$dir" -type f | wc -l)
72+
echo " $dir: $count files"
73+
fi
74+
done
75+
76+
# Summary
77+
echo ""
78+
echo "================================================"
79+
echo "Summary:"
80+
echo "================================================"
81+
82+
EXIT_CODE=0
83+
if [ -n "$OLD_REFS" ]; then
84+
echo -e "${RED}⚠ Action required: Old /img/ references found${NC}"
85+
EXIT_CODE=1
86+
fi
87+
88+
if [ $BROKEN_IMAGES -gt 0 ]; then
89+
echo -e "${RED}⚠ Action required: Broken image references found${NC}"
90+
EXIT_CODE=1
91+
fi
92+
93+
if [ $EXIT_CODE -eq 0 ]; then
94+
echo -e "${GREEN}✓ All image paths are valid!${NC}"
95+
fi
96+
97+
echo ""
98+
exit $EXIT_CODE

versioned_docs/version-0.7.0/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ Images are stored in the `images` directory alongside the documentation files. T
4444

4545
**Examples:**
4646
```markdown
47-
<!-- Markdown syntax -->
47+
<!-- Markdown syntax (no width control) -->
4848
![Alt text](./images/a.jpg)
4949

50-
<!-- HTML syntax with sizing -->
51-
<img src="./images/a.jpg" alt="Description" width="256px"/>
50+
<!-- HTML syntax with sizing (use require for Docusaurus) -->
51+
<img src={require('./images/a.jpg').default} alt="Description" width="256px"/>
5252
```
5353

5454
When you create a new documentation version using `npm run docusaurus docs:version X.X.X`, the images directory is automatically copied with the versioned docs.

versioned_docs/version-0.7.0/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_position: 0
55
# Serverless LLM
66

77
<!-- Scaled logo -->
8-
<img src="./images/serverlessllm.jpg" alt="ServerlessLLM" width="256px"/>
8+
<img src={require('./images/serverlessllm.jpg').default} alt="ServerlessLLM" width="256px"/>
99

1010
ServerlessLLM is a **fast** and **easy-to-use** serving system designed for **affordable** multi-LLM serving, also known as LLM-as-a-Service. ServerlessLLM is ideal for environments with multiple LLMs that need to be served on limited GPU resources, as it enables efficient dynamic loading of LLMs onto GPUs. By elastically scaling model instances and multiplexing GPUs, ServerlessLLM can significantly reduce costs compared to traditional GPU-dedicated serving systems while still providing low-latency (Time-to-First-Token, TTFT) LLM completions.
1111

versioned_docs/version-0.8.0/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ Images are stored in the `images` directory alongside the documentation files. T
4444

4545
**Examples:**
4646
```markdown
47-
<!-- Markdown syntax -->
47+
<!-- Markdown syntax (no width control) -->
4848
![Alt text](./images/a.jpg)
4949

50-
<!-- HTML syntax with sizing -->
51-
<img src="./images/a.jpg" alt="Description" width="256px"/>
50+
<!-- HTML syntax with sizing (use require for Docusaurus) -->
51+
<img src={require('./images/a.jpg').default} alt="Description" width="256px"/>
5252
```
5353

5454
When you create a new documentation version using `npm run docusaurus docs:version X.X.X`, the images directory is automatically copied with the versioned docs.

versioned_docs/version-0.8.0/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_position: 0
55
# Serverless LLM
66

77
<!-- Scaled logo -->
8-
<img src="./images/serverlessllm.jpg" alt="ServerlessLLM" width="256px"/>
8+
<img src={require('./images/serverlessllm.jpg').default} alt="ServerlessLLM" width="256px"/>
99

1010
ServerlessLLM is a **fast** and **easy-to-use** serving system designed for **affordable** multi-LLM serving, also known as LLM-as-a-Service. ServerlessLLM is ideal for environments with multiple LLMs that need to be served on limited GPU resources, as it enables efficient dynamic loading of LLMs onto GPUs. By elastically scaling model instances and multiplexing GPUs, ServerlessLLM can significantly reduce costs compared to traditional GPU-dedicated serving systems while still providing low-latency (Time-to-First-Token, TTFT) LLM completions.
1111

0 commit comments

Comments
 (0)