import os from jinja2 import Environment, Template import markdown # Configuration materials = ['1_situation', '2_binding', '3_paperformat', '4_add_ons'] output_file = 'output.html' # Prepare data for template rendering data = [] for folder in materials: markdown_files = os.listdir(folder) folder_data = { 'folder_name': folder, 'markdown_files': [] } for markdown_file in markdown_files: file_path = os.path.join(folder, markdown_file) with open(file_path, 'r') as file: content = file.read() folder_data['markdown_files'].append({'file_name': markdown_file, 'content': content}) data.append(folder_data) # Define the HTML template template = """