gtg922r/obsidian-numerals

Feature request: Calca-style result annotations

jwhitley opened this issue ยท 3 comments

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.

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:

  • Pre-process for => (or some other indicator) in the input. Output line gets annotated in some way
  • Provide plugin option to
    1. bold results that have the highlight/emit indicator (default) or
    2. only show results that have the highlight/emit indicator
  • Add a style option for inline rendering where the result immediately follows the input (similar to Calca)

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

@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.

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.