⚙ Smart Rem

Smart Rems are rem that can do stuff. They are like to plugins, but more lightweight, easier to implement, are somewhat better integrated into RemNote and have access to more data.

You can do:

  • Calculate arbitrary terms in JavaScript
  • Spotify playlists
  • Show information from external services (weather, ip, …)
  • Embed some websites (even documents from cloud storage)
  • Display any HTML (including iframes) and markdown (including markdown tables)

This is about 200 lines of code and 4-5 hours of tinkering. Much more stuff can be done in a few minutes/hours of work, like

  • >>> heatmap
  • all kinds of queries within RemNote (rems and cards)
  • WikiData queries
  • Dashboards integrating other information sources (stock prices)
  • UI elements (timer, inputs)

Right now this is limited to reading RemNotes offline database (IndexedDB). I don’t know if writing is save.

Since they are quite modular it should not be too difficult to distribute them as User Scripts through :scroll: RemNote Library: A place to discover and share Custom CSS (and more?).

Related Feature Requests:

Roam Research equivalent: Smart Blocks (I have not looked too much into this. Maybe there are some more cool things we can implement as well.)

16 Likes

Wow, this looks like a game changer. I assume this is going to be precursor to Native Plugins (Custom JavaScript), right?

2 Likes

I think this is more a single use case of those native plugins. It just evaluates single rems locally. Native plugins could also change the UX in fundamental ways, like a vim mode, or display informations more globally, like an overlay to visualize how good cards on a page are internalized.

4 Likes

Wow, this is really clever!

4 Likes

I’m obviously excited about this, but I don’t really understand what’s going on…
Is this an external app running through RemNote?
How do/will users… use it? :stuck_out_tongue:

1 Like

Just some extra JavaScript running in the background (user script or devtools console). Currently you would use it most comfortably through a browser extension (see [:cookie: User Script] Toggle Sidebar and Resize Pane Shortcuts on how to install one) which is obviously not possible in the mobile or desktop app (on desktop you could still paste stuff in the console).
That’s why I’d like Native Plugins (Custom JavaScript).

Don’t even get me started with external apps. Communicating with a locally running application would give you endless possibilities. Like accessing the file system and automating all kinds of stuff.

3 Likes

Amazing idea! What would be even cooler is to have support for “variables”, rems that store data like integers, floats, dates etc. which you can reference by name and then perform calculations on them. Imagine for example storing your bills for gas or something like that, you could then calculate different statistical data based on that. That way you could not only store stuff that you are learning but all sorts of data from your life.

4 Likes

Surely that would require something akin to Jupyter or Mathematica, which seems a bit heavy to inject with userscripts?

JavaScript libraries are (by nature, because they have to be downloaded and run in the browser) pretty small and modular. E.g. math.js which supports complex numbers, matrices and some symbolic computation is 150kb and even Plotly.js an all-in-one plotting solution, is only 1mb.

But is getting those math functions to interact with existing RemNote features also 150kb? Correct me if I’m wrong, but we aren’t talking a calculator in an iframe here, are we? Considering how shaky even plain text can be at this stage (jolly jumping carets, anyone?), perhaps it’s best to temper expectations. Even getting references to work in static Latex would be nice. Or hey, feel free to blow me out of the water with your skills, like you have done so many times before!

Supporting variables is trivial with RemNote’s key:: value format.

Aggregating values, e.g. sum the values of all rem tagged with #expenseX is also doable, but for that a bit more parsing is required.

4 Likes