gtg922r / obsidian-numerals

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

Table support #58

Open dav-garcia opened 1 year ago

dav-garcia commented 1 year ago

Hi,

This is a very high level feature recommendation, to be refined if found interesting.

The idea is to support tables both as data input for formulas and as output (formatted as Markdown tables). I understand that, in order to support Markdown tables, they should be defined out of the scope of the "math" block. And therefore, this would require a way to reference them, which might be very hard or even not possible.

Please comment if you think this feature could be useful. Thanks!

gtg922r commented 1 year ago

I don't think I quite follow this request. Could you describe an example use case?

dav-garcia commented 1 year ago

Here's a very simplistic use case of using a Markdown table as input data:

| Fruit  | Price |
| ------ | ----- |
| Apple  | $3    |
| Orange | $2    |
| Banana | $2.5  | 
[tableid: FRUITS]

```math
fruit_prices = [[FRUITS@I$2..@>$2]]
=> average_price = mean(fruit_prices)


Each table should have a unique id that can be referenced from within the math block.

I'm not recommending to use a specific format for both the table id and the reference.
Just used Dataview's `[key: value]` format to illustrate the need for a way to identify the table.
And the same goes for the table reference: a combination of a link and a table range as defined in the Advanced Tables plugin.

I don't know whether this feature is feasible, but I think it would be very useful to have computable data as Markdown tables.