处理单个 Markdown 文件 Args: input_path: 输入文件路径 output_path: 输出文件路径
(input_path, output_path)
| 57 | return text |
| 58 | |
| 59 | def process_file(input_path, output_path): |
| 60 | """ |
| 61 | 处理单个 Markdown 文件 |
| 62 | |
| 63 | Args: |
| 64 | input_path: 输入文件路径 |
| 65 | output_path: 输出文件路径 |
| 66 | """ |
| 67 | with open(input_path, 'r', encoding='utf-8') as f: |
| 68 | content = f.read() |
| 69 | |
| 70 | # 转换内容 |
| 71 | converted_content = convert_markdown(content) |
| 72 | |
| 73 | # 写入输出文件 |
| 74 | os.makedirs(os.path.dirname(output_path), exist_ok=True) |
| 75 | with open(output_path, 'w', encoding='utf-8') as f: |
| 76 | f.write(converted_content) |
| 77 | |
| 78 | print(f"Processed: {input_path} -> {output_path}") |
| 79 | |
| 80 | def main(): |
| 81 | """主函数""" |
no test coverage detected