feat: add +image
to code blocks to consume their output as an image
#429
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new
+image
attribute to code blocks. This inherits+exec_replace
(meaning it has the same semantics and requires being enabled with the same parameters) but it assumes the output of the executed block is an image and renders it as such.This means a presentation like the following one:
Renders like this
![image](https://private-user-images.githubusercontent.com/969090/407554283-e7bd7a97-5dd4-457b-ac24-1a6592ae6d24.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NjkxNzksIm5iZiI6MTczOTQ2ODg3OSwicGF0aCI6Ii85NjkwOTAvNDA3NTU0MjgzLWU3YmQ3YTk3LTVkZDQtNDU3Yi1hYzI0LTFhNjU5MmFlNmQyNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxM1QxNzQ3NTlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jNzg3ZTUxMjQ0MzRkMDA2YTMzNDZiM2Q4NDNhZDM4NTZjYzQ2NzJiNTlkYzk5MmM5YmFkMTE1NTJkNjNmZDBmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.b8WNHmZbfn808KhDvkumgXQp1Ufcpxhfg0zhoezoE4g)
For this to work, the entire output of the code snippet must be an image written to stdout.
An application of this feature could be to have text to image conversions to create titles on the fly. Hopefully this opens up the door for more creative ideas users will definitely have.