28 lines
818 B
Python
28 lines
818 B
Python
import os
|
|
import re
|
|
|
|
def fix_image_paths(file_path):
|
|
with open(file_path, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Fix Logo image at the top
|
|
content = content.replace('[
|
|
|
|
# Fix other image references
|
|
pattern = r'!\[\.\./_images/([^]]+)\]\(_images/([^)]+)\)'
|
|
content = re.sub(pattern, r'', content)
|
|
|
|
with open(file_path, 'w') as f:
|
|
f.write(content)
|
|
|
|
def process_directory(dir_path):
|
|
for root, dirs, files in os.walk(dir_path):
|
|
for file in files:
|
|
if file.endswith('.md'):
|
|
file_path = os.path.join(root, file)
|
|
fix_image_paths(file_path)
|
|
|
|
if __name__ == "__main__":
|
|
docs_dir = "/Users/dhanraj/Desktop/kpme_scraper/docs"
|
|
process_directory(docs_dir)
|