mfontanini / presenterm

A markdown terminal slideshow tool
https://mfontanini.github.io/presenterm/
BSD 2-Clause "Simplified" License
1.19k stars 29 forks source link

Visual indication for executable code snippets #278

Closed mfontanini closed 1 month ago

mfontanini commented 2 months ago

I'm creating this to see if someone has any ideas on how to do this: executable snippets should show something different that lets you realize they're executable. I can't think of a good way of doing this; IMO this should be:

I tried to put a little gear utf8 character in the bottom right corner of the code snippet but it doesn't look good. It is noticeable and non intrusive IMO but it doesn't look good.

A title on the top or bottom that says something like "executable snippet" would be noticeable but would be very intrusive to me.

Anyhow, if anyone has any ideas, please chime in.

marianozunino commented 1 month ago

@mfontanini Matias, first of all: great project, I'm using it heavily! I would love to contribute, but my rust skills are null.

So here's my suggestion for this feature:

 ▶ #include <stdio.h> // It replaces the line number 0
 1
 2 int main() {
 3     int arr[3] = {1, 2, 3};
 4     int value = arr[5];  // Accessing an out-of-bounds index
 5     return 0;
 6 }
mfontanini commented 1 month ago

Thanks for the kind words! Very nice, I like it. My idea is to make this indication configurable so it doesn't have to be forced to be this, there can be some decoration: play_button or something in the theme.

calebdw commented 1 month ago

@mfontanini,

You already show a bar for the execution status, what if you just always displayed it with a status of pending/not started instead of it suddenly appearing when the execution starts? The status progression would then be not started, running, finished.

image

FYI, it looks like the execution block is slightly smaller than the status bar...

DrunkenToast commented 1 month ago

I think the above solution is fine and clear, if you want to continue with the icon indication then I suggest the following: