From 1ca6ccbf4756d740f9fa24b321ad1aaffd8c6e4e Mon Sep 17 00:00:00 2001 From: "matthias@quintern.xyz" Date: Tue, 3 Dec 2024 16:49:57 +0100 Subject: [PATCH] avoid accidental formula parsing --- html-preprocessor | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/html-preprocessor b/html-preprocessor index 9c2b8b3..86e68c9 100755 --- a/html-preprocessor +++ b/html-preprocessor @@ -394,7 +394,8 @@ def cmd_include(args: str, variables:dict[str, str]={}) -> str: if filename.endswith(".md"): try: import mdtex2html as m2h # this package also converts tex to MathML - content = m2h.convert(content, extensions=["extra"]) + # replace #$ to avoid everything being parsed as formula + content = m2h.convert(content.replace('\\#$', 'REPLHASHDOLLAR').replace('#$', 'REPLHASHDOLLAR'), extensions=["extra"]).replace('REPLHASHDOLLAR', '#$') except: error("cmd_include", f"mdtex2html could not be imported, falling back to python-markdown for md to html conversion", level=error_levels["light"], exit_code=exit_codes["MarkdownConversionError"]) try: