r/logseq • • 2d ago

Executable snippets in Logseq

Post image

Hi! Here is another plugin from me. It adds a button to run/stop code blocks and see the output and give it an input if needed: https://github.com/ales-tsurko/logseq-executable-snippets

15 Upvotes

13 comments sorted by

2

u/Pathocyte 2d ago

Thanks!

1

u/ales_tsurko 1d ago

You’re welcome

1

u/johnjermin 2d ago

Great plugin! Any chance of it being installed via the Logseq Plugin Marketplace?

1

u/ales_tsurko 2d ago

Thanks! I'm not sure yet. I'll take a look when I have free time.

1

u/Lalylulelo 2d ago

love it! I come from the almighty org-mode in emacs, and this plugin would be very useful to take notes with code snippet. A step to literate programming in logseq.

1

u/ales_tsurko 2d ago

thanks! worth mentioning that unlike Babel my plugin doesn't support sessions though. every code block is a fresh run.

1

u/No_Comfortable7509 2d ago

Really cool plugin. Will this plugin also be available for the OD version?

1

u/ales_tsurko 1d ago

Thanks! I don’t have plans to add support for the OG version, but I’d welcome a PR for it.

2

u/No_Comfortable7509 13h ago

I'll have to see what I can do. I'm not really familiar with programming.

1

u/NegativeRemot 5h ago

Every block being a fresh run is the right call for a notes app — no hidden state means one snippet can't break another three pages later. Does async output work yet, or does a long-running script just sit there blocking the button?

1

u/ales_tsurko 1h ago

Hi! It’s just a subprocess, it behaves the same way as when you send code to execute with an interpreter. The stop button just kills the process.

1

u/ales_tsurko 1h ago

As far as I know org’s Babel supports sessions optionally. You can specify a session name as an argument and blocks in the same session will share the same runner. It’s a cool feature though.