enkimute / ganja.js

:triangular_ruler: Javascript Geometric Algebra Generator for Javascript, c++, c#, rust, python. (with operator overloading and algebraic literals) -
MIT License
1.52k stars 107 forks source link

KaTeX `md` with macros #136

Open kungfooman opened 3 years ago

kungfooman commented 3 years ago

It would be nice to be able to define KaTeX macros for md, maybe with a syntax like:

md(`$
  % \\f is defined as #1f(#2) using the macro
  \\f\\relax{x} = \\int_{-\\infty}^\\infty
    \\f\\hat\\xi\\,e^{2 \\pi i \\xi x}
    \\,d\\xi
$`, {
  macros: {
    "\\f": "#1f(#2)"
  }
});

Or like this, for global macros?

notebook({
  macros: {
    "\\f": "#1f(#2)"
  }
});
enkimute commented 2 years ago

Macro support is coming (including from external files).

kungfooman commented 2 years ago

Greeeeeeat (not sure what you mean with external files tho)