Smarter math and symbols

It would be great if logseq’s parser and renderer could be a bit smarter about math and certain symbols.

  • $…$ is for inline math, but it would be great if $1.23 didn’t start/end a math expression but instead get left as is, i.e. dollars. Specifically, $ followed by digits and decimal point wouldn’t end a math expression. I often have this trouble with “price: $1.23, with markup: $2.34”. (Right now you have to use \$2.34)
  • x between numbers (digits): turn into multiplication sign ✕ (e.g.: matching [0-9.]+x[0-9.])
  • Render negative numbers (\b-[0-9.]+\b) with Unicode minus sign (−) instead of dash (-)
  • smart substitutions: -> => <- <= become unicode arrows → ⇒ ← ⇐, --- becomes em dash —
  • # before number shouldn’t create a page link. I often type “#1” or “#12” and I think most people don’t want that turned into a page link. Specifically, matching regex #[0-9]+\b

I got some of these ideas from Markdeep Feature Demo

For substitutions you could try with custom commands. In config.edn file you should see some examples like turning js into JavaScript.

I use this for common math formulas, for example VDD is turn into $V_{DD}$.

2 Likes