Hi there!
I created the Interactivity plugin because I really missed the math and scripting functionality in my notes and thought others might benefit from it too!
Sometimes you need to compute numbers or access data while writing your notes. It’s handy to do this without leaving the Obsidian workspace, using your favorite tools like Python, Perl, Node.js, or others. For example, if you need to quickly calculate a project’s budget while taking notes, you can type the numbers and hit Enter in your Obsidian note to execute the code in the desired REPL:
## Mike's rate is $120. Thus, it will cost us:
@120*8*21*12+8000
249920
This plugin allows you to run shell commands and scripts directly within your notes, providing their output right alongside your written content, making your note-taking process more dynamic and interactive. By default, it supports running JavaScript, but you can also configure it to run any other shell commands.
Python Modules Collection:
My favorite daily tool is Python. This plugin includes several essential modules that enhance productivity while working in Obsidian.
chat.py Integrates ChatGPT directly into your notes.
tables.py Imports Excel and CSV tables into your notes.
plots.py Embeds matplotlib plots directly into your notes for quick visual data representation.
Here’s a demo of how they work with the plugin:
Check out the GitHub repository for detailed instructions, examples, and source code.
I look forward to your feedback and suggestions. Feel free to open issues on GitHub or discuss on this thread.
I suggest a more descriptive name — “Interactivity” conveys nothing about the plugin. I haven’t read the description in detail, but perhaps something like “Calculations and Scripts” (from the title of your announcement post) would work.
It’s an excellent plugin, but I have a few questions. It seems that plot.py, chat.py, and table.py aren’t functioning properly for me. I’ve noticed there are data.json, main.js, manifest.json, and styles.css files in the interactivity folder. I’ve downloaded your py_modules and py_manager.py files and added them to that folder, but it’s still not working. Could you provide some details?
– here is obsidian result
@x=[100,200,300,400]
@y=[1,2,3,4] @print(x)
[100, 200, 300, 400] @plot(x,y)
Traceback (most recent call last):
File “”, line 1, in
NameError: name ‘plot’ is not defined. Did you mean: ‘float’?
With this setting, you should place the python modules in the py_modules directory, so the path would look like this: ./your_vault/.obsidian/plugins/interactivity/py_modules/*.py.
Thanks for the reply, but I still don’t understand what to do.
What exactly should I enter in the Shell CLI Arguments?
-iq
C:\Obsidian\.obsidian\plugins\interactivity\py_modules/tables.py
C:\Obsidian\.obsidian\plugins\interactivity\py_modules/plots.py
C:\Obsidian\.obsidian\plugins\interactivity\py_modules/chats.py
No worries, let me explain how it works.
I assume that you have set up Python and have all the necessary Python files in the py_modules directory and py_manager.py in the plugin’s root directory. Next, all you need to do is configure the Shell CLI Arguments setting with the value specified on the GitHub page:
-iq
##plugin##py_manager.py
The plugin will automatically replace ##plugin## with the actual path to its directory. After this, everything should work.
Hi, just started using this plugin for making notes on math and it’s working great. But, is there a way to make it so that the “@2+2” is deleted once I press enter, and it just replaces the line with “4”? If not, could this feature be added in the future? Thanks.
Very underrated plugin unknown to many forum users.
The plugin’s py script manager reads the user-added custom python scripts which are triggered via plugin set trigger character and results are printed straight into the markdown editor, with no Execute or Run buttons like I’ve seen in other plugins.
Bit tricky to set up for the first-time user, I admit.
But if they persist, it pays dividends.
Here leveraging AnyTXT Searcher’s index of 140GB worth of PDF’s, mobi’s, etc via the program’s API (here I have too many results, so script decides that no context will be given here):
The text expanding at the start is done with Typing Transformer (see below*), so I need to add search_term only.
At the end, I show the trigger characters used for AI chat and my custom functions.
The highlights are from the Dynamic Highlights plugin, which highlights English texts via a regex I picked up here on the forum (I am bilingual and bicephalic ).
* Note:
I pressed Đ, which was expanded to what I want output:
On my Linux Mint, with a .pyenv needed for google-generativeai to be installed, I had a bit of a hard time to figure out how to have access to my Python and to get the scripts/functions to work.
I am enclosing a sample setup for the data.json of the plugin (for Linux).
You add your Python executable’s path in shellExex, and then you seem to need to add the absolute paths in shellParams and enviromentVariables, otherwise it may not work: