import os import re DOCS_DIR = 'docs' TARGET_WIDTH = "512" def should_process_file(filename): if not filename.endswith('.md'): return False match = re.search(r'Chapter_(\d+)', filename) if match: num = int(match.group(1)) return 25 <= num <= 46 return False def process_content(content): lines = content.split('\n') new_lines = [] i = 0 modified = False while i < len(lines): line = lines[i] # Pattern 1: Markdown images  md_img_match = re.search(r'!\[(.*?)\]\((.*?)\)', line) if md_img_match: alt_text = md_img_match.group(1) src = md_img_match.group(2) # Special handling for page headers if 'page_header.svg' in src: alt_text = "" # No width for page headers (full width) replacement = f'
\n \n
\n \n