Update app.py
Browse files
app.py
CHANGED
@@ -541,6 +541,11 @@ def generate_pdf(documentation):
|
|
541 |
|
542 |
# Helper function to generate Markdown file
|
543 |
def generate_markdown_file(documentation):
|
|
|
|
|
|
|
|
|
|
|
544 |
project_name = st.session_state.current_project
|
545 |
markdown_file_name = f"{project_name} Documentation.md"
|
546 |
|
@@ -562,7 +567,7 @@ def generate_markdown_file(documentation):
|
|
562 |
with open(markdown_file.name, "w") as f:
|
563 |
f.write(formatted_documentation)
|
564 |
|
565 |
-
#
|
566 |
st.download_button(
|
567 |
label="Download Markdown File",
|
568 |
data=open(markdown_file.name, "rb").read(),
|
@@ -571,6 +576,7 @@ def generate_markdown_file(documentation):
|
|
571 |
)
|
572 |
os.unlink(markdown_file.name)
|
573 |
|
|
|
574 |
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
575 |
|
576 |
|
|
|
541 |
|
542 |
# Helper function to generate Markdown file
|
543 |
def generate_markdown_file(documentation):
|
544 |
+
# Ensure the user folder is defined
|
545 |
+
user_folder = os.path.join("user_projects", st.session_state.username)
|
546 |
+
os.makedirs(user_folder, exist_ok=True)
|
547 |
+
|
548 |
+
# Generate the Markdown file name
|
549 |
project_name = st.session_state.current_project
|
550 |
markdown_file_name = f"{project_name} Documentation.md"
|
551 |
|
|
|
567 |
with open(markdown_file.name, "w") as f:
|
568 |
f.write(formatted_documentation)
|
569 |
|
570 |
+
# Provide download button for the Markdown file
|
571 |
st.download_button(
|
572 |
label="Download Markdown File",
|
573 |
data=open(markdown_file.name, "rb").read(),
|
|
|
576 |
)
|
577 |
os.unlink(markdown_file.name)
|
578 |
|
579 |
+
|
580 |
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
581 |
|
582 |
|