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: inline expression display #5

Open jwhitley opened 1 year ago

jwhitley commented 1 year ago

Concept

Allow inline blocks with simple expressions. These might be variable references ala `mathexpr: length` (referring the variable length from a ```math block in the same note) or other expressions like `mathexpr: 3*4`. These would be rendered as an evaluated result in the place of the inline math expression.

Caveats

I'd done very quick triage of this for the math plugin I was contemplating, and noted that the two block styles are processed separately by the Obsidian API. I hadn't gotten to the point of sorting out feasibility and/or what would be required to ensure that the inline blocks as above were processed after the code blocks. It didn't appear feasible to ensure that the two styles could be processed in sequential order down a note, so a simplifying assumption I made was that the inline style is only ever used for displaying results (i.e. can be processed strictly after the code blocks) and never defines variables, functions, etc.

gtg922r commented 1 year ago

This is definitely something I want to look in to. Dataview has it figured out so I'll have to see how they did it.

Almost certainly this will be addressed after the initial release though as I want to focus on getting code block rendering out the door.

jwhitley commented 1 year ago

Sounds good. And I completely agree with keeping releases tidy. Nothing urgent here relative to just getting it out the door.

I’m definitely happy to pitch in with some PRs, esp. since I was ready to roll my own plugin anyhow. I’ll start digging into the codebase here, and Dataview as well.

technodrome commented 10 months ago

Any progress on this one? Many would find this very handy.

gtg922r commented 10 months ago

Yeah, to be honest this is my personal top feature request. However, as far as I can tell it requires implementing a new renderer in a whole different section of a API that is not as easily interfaced with as the code blocks. So might be a bit before I have the time to dig in to it.

In the interim, keep in mind that dataview can handle easy math cases with their inline rendering. If you turn on inline rendering =1+1 will render to 2