Closed DrunkenToast closed 3 weeks ago
For example CLI tools for creating text graphs
Can you provide examples of what you'd want to create? For the record, mermaid support for +render
blocks works in master and I think that would cover most "nice" graphs you'd want and would also look way better than an ascii graph.
Didn't know about mermaid, but I think the limit is your imagination the moment you can do it with scripts.
The tool I was thinking of was graph-easy
however.
So just to be clear, what you want exactly is something like what today happens when you press <c-e>
on a +exec
block but you want that automatically and you want the original code to not even show up. You just want the code to be replaced automatically with the output of running said code?
So just to be clear, what you want exactly is something like what today happens when you press
<c-e>
on a+exec
block but you want that automatically and you want the original code to not even show up. You just want the code to be replaced automatically with the output of running said code?
Yes.
You add a code block with +render
and it is immediately executed and put on the slide. No special highlighting (besides maybe centering), no codeblocks are shown, only the output.
Some examples might be:
The writer can use any tool they want or are familiar with. It would simply appear as if you had copy-pasted the output in there yourself, 'rendering' it.
If this functionality is actually different from the other 'render' things, you could also call it +pre_process
or something instead as well. But I think categorizing it under 'render` makes sense.
An option to interpret it as markdown for custom slide content would be super cool and fancy but seems excessive.
The +render
flag has been used to render images that are then inserted into the presentation. You might could allow arbitrary script invocation, but then you need someway of know what image is produced to display it. This is different than tools like cowsay
which write to stdout
An option to interpret it as markdown for custom slide content would be super cool and fancy but seems excessive.
If presenterm
could read from stdin then a script could pipe dynamic content into it at the time of presentation:
./my_dynamic_presentation | presenterm --present
Or more simply, you just write a script that uses any number of templating languages to dynamically generate your presentation:
./my_dynamic_presentation > dynamic_presentation.md
presenterm --present dynamic_presentation.md
The
+render
flag has been used to render images that are then inserted into the presentation. You might could allow arbitrary script invocation, but then you need someway of know what image is produced to display it. This is different than tools likecowsay
which write to stdoutAn option to interpret it as markdown for custom slide content would be super cool and fancy but seems excessive.
If
presenterm
could read from stdin then a script could pipe dynamic content into it at the time of presentation:./my_dynamic_presentation | presenterm --present
Or more simply, you just write a script that uses any number of templating languages to dynamically generate your presentation:
./my_dynamic_presentation > dynamic_presentation.md presenterm --present dynamic_presentation.md
If +render
is preserved for images than I would still opt for a +pre_process
option.
While piping in-and-of itself is not a bad idea, it is not what this issue is meant for. This is simply for having script's output be inserted into slides.
slides does something similar. Although IMO with a horrible syntax.
Example:
## My cool data slide
|```bash +pre_process
| ./assets/data.csv | gnuplot | lolcat
|```
### Takeaways
- Graph is linear (and colorful)
The idea is that the limit is the users imagination with ASCII tools. There may be hundreds of cool cli utilities that would be useful to insert as content into the slides without presenterm having explicitly support these.
Taking this idea even further:
## My other slide
|```js +pre_process_md
|console.log("### My points")
|
|for (let i = 0; i < 10; i++) {
| console.log("- ***Point*** " + (i+1))
|}
|```
I created https://github.com/mfontanini/presenterm/pull/330 for this. I ended up calling this +exec_replace
because I found pre_process
to be too vague, e.g. preprocess how?. This makes naming this a bit annoying but I think it's more descriptive. I'm open to alternatives tho!
The idea of adding
+render
is that is it rendered when the presentation is created. It would be incredibly useful to have scripts that make up content of the presentation be rendered as well, however currently only latex and typst are supported.For example CLI tools for creating text graphs can be put in a bash +render block, allowing you to insert CLI graphs easily in your presentation. Even for programming languages, a quick and dirty js script in your presentation to programmatically create content in a slide could be handy.
This can also be a different option from
+render
if we want to preserve that for images.