observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
967 stars 83 forks source link

asciimath template literal #8

Closed anandthakker closed 6 years ago

anandthakker commented 6 years ago

This only occurred to me because because #7 said:

Since the Viz.js dependency is lazily loaded this would be a very small addition to the stdlib

Asciimath is pretty great when I'm typing quick math and I don't feel like going all-in on Latex. It's roughly, "type math the way you would in your code or your TI-83 calculator".

asciimath = {
   const amToTex = await require('https://wzrd.in/standalone/asciimath-to-latex/');
   return function(strings, ...args) {
       return tex(strings.map(amToTex), ...args.map(amToTex));
   };
}

Then again, Viz.js is surely a much more stable dependency than asciimath-to-latex, and dot\`` adds a totally new dimension of functionality whereas this is just a variation, so understood if you simply close with prejudice.

anandthakker commented 6 years ago

https://beta.observablehq.com/@anandthakker/ascii-math

mbostock commented 6 years ago

Thanks for the suggestion, Anand. Our current plan is to try to keep the stdlib small, so we’re going to stick with KaTeX/LaTeX for now. But as you discovered you can always require/import from npm or another notebook to use something outside of stdlib as you prefer.