-
-
Notifications
You must be signed in to change notification settings - Fork 62
Add mathjs
singleton and expose it via API
#481
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
Conversation
This brings up an important point. The additions to mathjs only work once the code adding them has run. Code block execution order in a file is usually top to bottom, but that is not guaranteed. They can theoretically run in any order, so math view fields could run before the js-engine code block adding the needed mathjs extensions. One approach could be to enable users to somehow register global mathjs extensions on plugin load. |
that would be super annoying if it happens randomly sometimes.
I also thought about adding a config option where the user could input a object to initialize the context with. This was just the quickest way to get a working version to test if it works at all. |
yeah, maybe a path to a JS file that get's run via js-engine at statup |
I like the Idea, maybe identically to how Base Obsidian handles css snippets, just as JS snippets. But it starts to feel more like it should be a Feature of JS-engine now? |
Yeah. Maybe it's better to just add a simple API to MB and the startup script thing to js-engine |
After a few days of thought, I want to go with a simple API on the MB side and adding startup scripts to js-engine. |
I just released statup scripts in js-engine |
9ad4629
to
20978cd
Compare
This allows for modification of `mathjs` by the user, mostly to allow for the use of `math.import` to define custom functions
20978cd
to
24f312c
Compare
a2d6101
to
e84db40
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far, but I think tutorial should be moved to the docs.
e84db40
to
4d09aab
Compare
documentation moved to mProjectsCode/obsidian-meta-bind-plugin-docs#12 |
Thanks :) |
This allows for modification of
mathjs
by the user, mostly to allow for the use ofmath.import
to define custom functions.See the new
Advanced Examples/Customising mathjs
for details.closes #480
This is a first implementation, it works but I am sure there are better ways to implement the singleton.
Finding the right place in the lifecycle of the app just went over my head
I am also unsure if the
MathjsInstance
should be per-app or per file?