use mdtex2html for md conversion
This commit is contained in:
parent
ebb04723dd
commit
66cf5ca912
@ -393,11 +393,16 @@ def cmd_include(args: str, variables:dict[str, str]={}) -> str:
|
|||||||
content = f"<!-- Could not include '{filename}' -->"
|
content = f"<!-- Could not include '{filename}' -->"
|
||||||
if filename.endswith(".md"):
|
if filename.endswith(".md"):
|
||||||
try:
|
try:
|
||||||
from markdown import markdown
|
import mdtex2html as m2h # this package also converts tex to MathML
|
||||||
content = markdown(content, output_format="xhtml")
|
content = m2h.convert(content, extensions=["extra"])
|
||||||
except:
|
except:
|
||||||
error("cmd_include", f"Could convert markdown to html for file '{filename}'. Is python-markdown installed?", level=error_levels["critical"], exit_code=exit_codes["MarkdownConversionError"])
|
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"])
|
||||||
content = f"<!-- Could not convert to html: '{filename}' -->"
|
try:
|
||||||
|
from markdown import markdown
|
||||||
|
content = markdown(content, output_format="xhtml", extensions=["extra"])
|
||||||
|
except:
|
||||||
|
error("cmd_include", f"Could convert markdown to html for file '{filename}'. Is python-markdown installed?", level=error_levels["critical"], exit_code=exit_codes["MarkdownConversionError"])
|
||||||
|
content = f"<!-- Could not convert to html: '{filename}' -->"
|
||||||
glob_dependcies.append(filename)
|
glob_dependcies.append(filename)
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user