Skip to content

Commit 49e9a7c

Browse files
committed
Convert relative links to raw GitHub links [automated]
1 parent 8702b27 commit 49e9a7c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

replace_links.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ def main():
2222

2323
# Pattern 1: HTML img tags with relative paths
2424
content = re.sub(
25-
r'<img([^>]*?)src="(\.\.?/[^"]*)"',
25+
r'<img([^>]*?)src="\.\.?/([^"]*)"',
2626
f'<img\\1src="{base_url}\\2?raw=true"',
2727
content
2828
)
2929

3030
# Pattern 2: Markdown image syntax
3131
content = re.sub(
32-
r'!\[([^\]]*?)\]\((\.\.?/[^)]*?)\)',
32+
r'!\[([^\]]*?)\]\(\.\.?/([^)]*?)\)',
3333
f'![\\1]({base_url}\\2?raw=true)',
3434
content
3535
)
3636

3737
# Pattern 3: Markdown links to images
3838
content = re.sub(
39-
r'\[([^\]]*?)\]\((\.\.?/[^)]*?\.(png|jpg|jpeg|gif|svg|webp))\)',
39+
r'\[([^\]]*?)\]\(\.\.?/([^)]*?\.(png|jpg|jpeg|gif|svg|webp))\)',
4040
f'[\\1]({base_url}\\2?raw=true)',
4141
content,
4242
flags=re.IGNORECASE

0 commit comments

Comments
 (0)