From a3ac64ab5d133c1e96f73be9c7737cd247745346 Mon Sep 17 00:00:00 2001 From: Eric David Smith Date: Sat, 8 Jul 2023 15:07:27 -0400 Subject: [PATCH] Update wiki-to-md.py --- wiki-to-md.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wiki-to-md.py b/wiki-to-md.py index 4db061c..4636dbe 100644 --- a/wiki-to-md.py +++ b/wiki-to-md.py @@ -26,7 +26,11 @@ def generate_markdown(topic): ): markdown_text += f"{sections[i]}\n{sections[i+1]}\n\n" - filename = f'{topic.replace(" ", "_")}.md' + # Create a directory for markdown files + directory = "md_output" + os.makedirs(directory, exist_ok=True) + + filename = os.path.join(directory, f"{topic.replace(' ', '_')}.md") with open(filename, "w") as md_file: md_file.write(markdown_text)