htr_demo / app /utils /md_helper.py
Gabriel
Starting adding language support
381bbf4
raw
history blame
476 Bytes
import os
def load_markdown(language, section, content_dir="app/content"):
"""Load markdown content from files."""
if language is None:
file_path = os.path.join(content_dir, f"{section}.md")
else:
file_path = os.path.join(content_dir, language, f"{section}.md")
if os.path.exists(file_path):
with open(file_path, "r", encoding="utf-8") as f:
return f.read()
return f"## Content missing for {file_path} in {language}"