Skip to content
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

Feature request: Calca-style result annotations #4

Closed
jwhitley opened this issue Nov 8, 2022 · 3 comments
Closed

Feature request: Calca-style result annotations #4

jwhitley opened this issue Nov 8, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request release Completed. Will be in next release

Comments

@jwhitley
Copy link
Contributor

jwhitley commented Nov 8, 2022

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
Copy link
Owner

gtg922r commented Nov 9, 2022

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.

@gtg922r gtg922r added enhancement New feature or request roadmap Planned feature on the roadmap labels Nov 9, 2022
gtg922r added a commit that referenced this issue Dec 3, 2022
Initial support for Calca style annotations/emitters

If `=>` is present in the block, lines without it will be faint
gtg922r added a commit that referenced this issue Dec 4, 2022
- Added a setting for whether to hide non-emitted rows (when they are used at all).
  - Default is to hide non-emitted rows (if they are use in the code block)
- added a setting for hiding emitter annotation in input.
  - Default is to hide annotation in the input.
  - Only applies to Plain text. It's automatically hidden from the other render types
@gtg922r
Copy link
Owner

gtg922r commented Dec 9, 2022

@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
Copy link
Contributor Author

jwhitley commented Dec 9, 2022

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.

@gtg922r gtg922r added the in-progress Currently in development label Dec 13, 2022
@gtg922r gtg922r added release Completed. Will be in next release documentation Improvements or additions to documentation and removed in-progress Currently in development roadmap Planned feature on the roadmap labels Dec 19, 2022
@gtg922r gtg922r closed this as completed Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request release Completed. Will be in next release
Projects
None yet
Development

No branches or pull requests

2 participants