gtg922r / obsidian-numerals

An obsidian plugin which turns a math code block into a full featured calculator
Other
391 stars 8 forks source link

Feature request: Calca-style result annotations #4

Closed jwhitley closed 1 year ago

jwhitley commented 1 year ago

Well, you've probably saved me from writing a plugin 😂 so here's a feature request I had on my list. My main inspiration for an Obsidian math plugin comes from Calca, a Markdown-based text editor with calculation support. As opposed to a Soulver-esque line-by-line result tally, Calca adds a => line suffix that causes the result at that line to be emitted. Otherwise results aren't printed.

Have a look at the Calca link above; the homepage illustrates the output format nicely. In addition, a quick example:

```math
length = 40mm
width = 20mm
area = length * width => 800mm^2


The result `800mm^2` would be emitted by the plugin (in Live Preview / Reading mode, obvs), triggered by the `=>` result annotation.

In practice, this may want a different tag than `math` to distinguish the syntax, such as `mathc` or somesuch.

My plan had been to support both line-by-line and Calca-style output systems.  Both can be really helpful in different scenarios.  Calca's support is great to highlight key results without a lot of intermediate noise.
gtg922r commented 1 year ago

Thanks for sharing Calca, I hadn't seen that before and it looks interesting!

I definitely like the idea of highlighting certain results. I have some notes with very lengthy calculations, where there is lots of variable setup up top. It gets visually noisy and the grand result at the bottom gets lost.

I'm hesitant to add too many options that would require changing the content of the code block, but I do want to give people options. Here's what I'm thinking for now:

This way it works without using =>, but gives you the option to highlight (or only show) particular results.

gtg922r commented 1 year ago

@jwhitley The latest release has the initial implementation of this. I initially referred to the annotation in settings as an "emitter", but I'm going to switch the name to "result annotation".

Anyway, it generally works exactly as I described above as each of the 3 proposed features has been implemented.

Would love any feedback.

By the way, Numerals has been accepted into the Community plugin list so you can just get it from there.

jwhitley commented 1 year ago

AWESOME! I love it. Sorry for the radio silence; I've been a bit swamped lately. Have Numerals installed and am digging in now. Also, math-tex looks great too. Wonderful to have that support in the same plugin. Sometimes going full TeX is overkill, but sometimes it's just the ticket.