r/logseq • • 20d 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

23 Upvotes

13 comments sorted by

3

u/Pathocyte 19d ago

Thanks!

1

u/ales_tsurko 19d ago

You’re welcome

2

u/NegativeRemot 17d 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 17d 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 17d 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.

1

u/johnjermin 20d ago

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

1

u/ales_tsurko 20d ago

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

1

u/Lalylulelo 20d 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 20d 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 19d ago

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

2

u/ales_tsurko 19d 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 18d ago

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