-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add additional units #47
Comments
Checkout the mathjs documentation. it allows you to create your own custom units. Also, teaspoon and tablespoon are already implemented. see: https://mathjs.org/docs/datatypes/units.html |
Very cool. I'm not such a pro on this. Would you be able to provide an example of how to create a custom unit with numerals calling this mathjs function? What would be awesome. |
In a Numerals's block, follow the syntax and type something like
Let the equation execute and when you're done, go to edit it and go out of it. It should give you an error saying you can't have the same unit defined. It should persist after that |
Nice, I did that I see the error you mentioned. How long does this new custom unit persist for? It seems to persist across notes but when I close obsidian and reboot it, the custom unit doesn't seem to be recognized anymore. |
Definitely plan to support custom units. The error you are seeing is mathjs throws an error when a unit is created that matches the name of an existing one. Which, currently, will happen if you use I just need to check if the unit already exists and then not re-call the mathjs function. I might need a custom syntax. |
It’d be a cool option to have in the settings that you can specify a unit and a relation to other units. Then when the block runs, have that check to see if the unit exists or refresh it if it changes
… On Jul 3, 2023, at 3:25 PM, Ryan C ***@***.***> wrote:
Definitely plan to support custom units.
The error you are seeing is mathjs throws and error when a unit is created that matches the name of an existing one. Which, currently, will happen if you use createUnit since it is run every time the codeblock is rendered.
I just need to check if the unit already exists and then not re-call the mathjs function. I might need a custom syntax.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.
|
|
As a temporary hack, this works, and you just need to define unit once on top of the page, and no need to repeat the definition.
|
Hi,
I enjoyed this wonderful plugin since its installation. I started experimenting using it to portion recipe, but ran into issues parsing units such as tsp (teaspoon) or tbsp (tablespoon). Is there a way to add more units to the plug-in or even the potential to add custom units, such as through the settings or a .js file, etc. Thanks!
The text was updated successfully, but these errors were encountered: