diff --git a/src/api/util.py b/src/api/util.py index 3982bab..081c3bc 100644 --- a/src/api/util.py +++ b/src/api/util.py @@ -45,6 +45,7 @@ def sanitize_to_markdown(text: str) -> str: text = text.replace("\\", "\\\\").replace('//', '/\\/').replace("](", "]\\(") # replace escaping and links text = re.sub(r"([`_*~:<>{}@|])", "\\\\\\1", text) # Escape common Markdown characters text = re.sub(r"^(#+ )", '\\\\\\1', text, 0, re.MULTILINE) # Escape headers + text = re.sub(r"^(-# )", '\\\\\\1', text, 0, re.MULTILINE) # Escape subtext text = re.sub(r"^(\s*)- ", '\\1\\\\- ', text, 0, re.MULTILINE) # Escape lists text = re.sub(r"^(\s*\d+)\. ", "\\1\\\\. ", text, 0, re.MULTILINE) # Escape numbered lists return text