heynote icon indicating copy to clipboard operation
heynote copied to clipboard

Is there a way to have a javascript function for format in math blocks?

Open hanoii opened this issue 1 year ago • 1 comments

I don't know or think this is possible, but thought of asking.

I wanted to format the numbers with some locale as they are currently currency and it's easier to follow.

I managed to do it with:

format(x) = x.toLocaleString('es-ar');

However, I am not super sure about to extent of javascript I could do with format. I tried complex functions, anonymous functions, arrows functions ,but none worked. It this this work only because it ends up being a valid math block function, but can I use a more complex format callback some how in the max block?

hanoii avatar Feb 16 '24 13:02 hanoii

The syntax should be that of Math.js expressions:

https://mathjs.org/docs/expressions/ https://mathjs.org/docs/expressions/syntax.html

heyman avatar Jul 14 '24 11:07 heyman