twibiral / obsidian-execute-code

Obsidian Plugin to execute code in a note.
MIT License
991 stars 61 forks source link

Sagemath Support #127

Open cervera-queiroz opened 1 year ago

cervera-queiroz commented 1 year ago

Hey guys,

Is there any possibility to include Sagemath as one of the supported languages?

Thanks

chlohal commented 1 year ago

Sure!

From a quick look at their docs, it seems like Sage doesn't have any way to execute a file non-interactively. Is there any way to do this, or would most Sagemath users prefer for it to only be available in Notebook Mode?

chlohal commented 1 year ago

Hi! I just wanted to follow up on this. Sagemath seems really interesting, and it's definitely something that I would like to contribute support for. The only issue is the requirement for interactive code: if sage could run a script file, then it would be very easy; do you know if that's possible?

pelegm commented 4 months ago

Yes, it is possible. E.g., test.sage may contain print(3), and then running sage test.sage prints 3.

pelegm commented 4 months ago

The main (or only?) difficulty should arise when someone wishes to plot. The only solution I've found for plotting from the command line is this workaround: https://ask.sagemath.org/question/37719/how-can-i-display-a-plot-from-a-script/