mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Escape subtext
This commit is contained in:
parent
f80c671964
commit
60d8251033
|
@ -45,6 +45,7 @@ def sanitize_to_markdown(text: str) -> str:
|
||||||
text = text.replace("\\", "\\\\").replace('//', '/\\/').replace("](", "]\\(") # replace escaping and links
|
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) # 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 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*)- ", '\\1\\\\- ', text, 0, re.MULTILINE) # Escape lists
|
||||||
text = re.sub(r"^(\s*\d+)\. ", "\\1\\\\. ", text, 0, re.MULTILINE) # Escape numbered lists
|
text = re.sub(r"^(\s*\d+)\. ", "\\1\\\\. ", text, 0, re.MULTILINE) # Escape numbered lists
|
||||||
return text
|
return text
|
||||||
|
|
Loading…
Reference in a new issue