MCPcopy
hub / github.com/Vonng/ddia / process_file

Function process_file

bin/preprocess-epub.py:59–78  ·  view source on GitHub ↗

处理单个 Markdown 文件 Args: input_path: 输入文件路径 output_path: 输出文件路径

(input_path, output_path)

Source from the content-addressed store, hash-verified

57 return text
58
59def 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
80def main():
81 """主函数"""

Callers 1

mainFunction · 0.85

Calls 1

convert_markdownFunction · 0.85

Tested by

no test coverage detected