import streamlit as st import os # Function to read markdown files def load_markdown_file(path): with open(path, 'r') as file: content = file.read() return content # Streamlit UI st.title('Documentation') # Assuming your documentation is in the 'docs' folder docs_base_path = './docs' # List categories based on folder names categories = [d for d in os.listdir(docs_base_path) if os.path.isdir(os.path.join(docs_base_path, d))] category = st.sidebar.selectbox('Select a Category', categories) # List pages based on markdown files in the selected category folder pages_path = os.path.join(docs_base_path, category) pages = [f for f in os.listdir(pages_path) if os.path.isfile(os.path.join(pages_path, f))] page = st.sidebar.selectbox('Select a Page', pages) # Load and display the selected markdown file markdown_path = os.path.join(pages_path, page) markdown_content = load_markdown_file(markdown_path) st.markdown(markdown_content, unsafe_allow_html=True)