Lenylvt commited on
Commit
9b50500
β€’
1 Parent(s): 49bea70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -21
app.py CHANGED
@@ -11,7 +11,7 @@ def load_markdown_file(path):
11
  return f"Error reading file: {e}"
12
 
13
  # Streamlit UI Enhancements
14
- st.title('πŸ“š Documentation Viewer')
15
 
16
  # Assuming your documentation is in the 'docs' folder
17
  docs_base_path = './docs'
@@ -26,7 +26,9 @@ else:
26
  if not categories:
27
  st.error('No categories found in the documentation directory.')
28
  else:
29
- category = st.sidebar.selectbox('Select a Category', categories)
 
 
30
 
31
  # List pages based on markdown files in the selected category folder
32
  pages_path = os.path.join(docs_base_path, category)
@@ -34,28 +36,11 @@ else:
34
  if not pages:
35
  st.error('No markdown pages found in the selected category.')
36
  else:
37
- page = st.sidebar.selectbox('Select a Page', pages)
38
 
39
  # Load and display the selected markdown file
40
  markdown_path = os.path.join(pages_path, page)
41
  markdown_content = load_markdown_file(markdown_path)
42
  st.markdown(markdown_content, unsafe_allow_html=True)
43
  except Exception as e:
44
- st.error(f"Error listing categories or pages: {e}")
45
-
46
- # Optional: Add a theme or custom CSS for styling
47
- st.markdown(
48
- """
49
- <style>
50
- .css-18e3th9 {
51
- background-color: #f0f2f6;
52
- }
53
- .css-1d391kg {
54
- padding-top: 1rem;
55
- padding-left: 1rem;
56
- padding-right: 1rem;
57
- }
58
- </style>
59
- """,
60
- unsafe_allow_html=True,
61
- )
 
11
  return f"Error reading file: {e}"
12
 
13
  # Streamlit UI Enhancements
14
+ st.title('πŸ“š Documentation')
15
 
16
  # Assuming your documentation is in the 'docs' folder
17
  docs_base_path = './docs'
 
26
  if not categories:
27
  st.error('No categories found in the documentation directory.')
28
  else:
29
+ st.sidebar.markdown('## 🧷 Navigation')
30
+
31
+ category = st.sidebar.selectbox('πŸ“ Select the Space', categories)
32
 
33
  # List pages based on markdown files in the selected category folder
34
  pages_path = os.path.join(docs_base_path, category)
 
36
  if not pages:
37
  st.error('No markdown pages found in the selected category.')
38
  else:
39
+ page = st.sidebar.selectbox('πŸ“œ Select the Page', pages)
40
 
41
  # Load and display the selected markdown file
42
  markdown_path = os.path.join(pages_path, page)
43
  markdown_content = load_markdown_file(markdown_path)
44
  st.markdown(markdown_content, unsafe_allow_html=True)
45
  except Exception as e:
46
+ st.error(f"Error listing categories or pages: {e}")