mfontanini / presenterm

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

feat: allow snippets to be executed and replaced with output #330

Closed mfontanini closed 3 months ago

mfontanini commented 3 months ago

This adds the +exec_replace attribute that is basically an +exec except the output of the snippet's execution replaces the snippet itself. This allows using tools that emit ascii art, colorize outputs, etc.

I added a new set of configs to enable this (-X as a cli parameter and snippet.exec_replace.enable in the config file) as this adds a whole other level of danger when running someone else's presentation so I don't think the configs for exec are enough to protect users.

Fixes #292

calebdw commented 3 months ago

I added a new set of configs to enable this (-X as a cli parameter and snippet.exec_replace.enable in the config file) as this adds a whole other level of danger when running someone else's presentation

I'm not sure I see how exec + replace is any more dangerous than exec?

mfontanini commented 3 months ago

Because it happens automatically on presentation load. So you open a presentation and this runs code without user intervention

DrunkenToast commented 3 months ago

Good call with -X, fan of that.
I think I like the replace better than the pre_process, although I am not sure if it is clear whether or not it render the replaced output as markdown or not.

mfontanini commented 3 months ago

I'll merge this as is, if someone has a better name please shout