mbarkhau / markdown-katex

Adds KaTeX support for Python Markdown
MIT License
16 stars 10 forks source link

Can I config sytax? #11

Open xiayulu opened 3 years ago

xiayulu commented 3 years ago

Inline math sytax: $...$ and block math sytax $$...$$ are so common in markdown. If we can config it, that will be awesome.

mbarkhau commented 3 years ago

I am open to it in principle and would accept a PR for this. It would require some refactoring in https://github.com/mbarkhau/markdown-katex/blob/master/src/markdown_katex/extension.py

Are you interested in working on this?

shubhamshah02 commented 2 years ago

Can someone please add this in?

tovrstra commented 1 year ago

For those looking for a quick workaround in anticipation of a pull request, the following line preprocesses your conventional inline LaTeX equations to a format suitable for this extension:

text_md = re.sub(r"\B\$(\S|\S[^\n\r]*?\S)\$\B", r"$`\1`$", text_md)

It is not ideal for reasons explained by @mbarkhau, but not all use cases give one the freedom to choose the delimiters.