bouncepaw / mycorrhiza

🍄📑 Filesystem and git-based wiki engine for the independent web written in Go using Mycomarkup as its primary markup language.
https://mycorrhiza.wiki
GNU Affero General Public License v3.0
290 stars 26 forks source link

Math/LaTeX support in markup #234

Open legendre6891 opened 3 weeks ago

legendre6891 commented 3 weeks ago

Hi, this looks like a great piece of software. I’m wondering if math is supported in the markup language?

e.g. either by relying on JS lib like MathJaX, or inline SVGs (in which case the user is responsible for generating the SVGs to include)

thanks!

bouncepaw commented 3 weeks ago

There's no direct support for math. At most, you can embed images, but not inline, only block. Do you think we should have math support? What kind of syntax would you expect?

legendre6891 commented 3 weeks ago

I think it would be great to have math support -- my personal notes have a lot of mathematical content it'd be a core feature for me (I'm surveying the personal wiki landscape and came across this project today).

As for syntax, I think it would make sense to use LaTeX's $ signs since that's the standard in the field. As for markup, I think pandoc has nice system. From here,

Anything between two $ characters will be treated as [inline] TeX math. The opening $ must have a non-space character immediately to its right, while the closing $ must have a non-space character immediately to its left, and must not be followed immediately by a digit. Thus, $20,000 and $30,000 won’t parse as math. If for some reason you need to enclose text in literal $ characters, backslash-escape them and they won’t be treated as math delimiters.

For display math, use $$ delimiters. (In this case, the delimiters may be separated from the formula by whitespace. However, there can be no blank lines between the opening and closing $$ delimiters.)

(Here, "display math" means: a centered math block, as opposed to inline.)