-
Notifications
You must be signed in to change notification settings - Fork 15
Image Generation
Overview of Markdown CodeBlock attributes for managing the behavior of image generation scripts.
Any block of code containing a skip CSS classname will be omitted from image generation script.
~~~{.skip}
Codeblock not to be executed
~~~
Many documents require additional embedded commands to be run; however, they are not directly related to the topic of the document/example. The common hide classname is inherited by many CSS frameworks, and can be used to inject additional image-generation statements.
~~~{.hide}
# Create a browser friendly version of MVG format
convert example.mvg example.mvg.gif
~~~
Both stderr and stdout can be captured. The expected handling of captured output is to redirect the stream to a text file, and generate a GIF image displaying the content of.
~~~{data-capture-out="example_stdout.txt"}
identify -verbose rose:
~~~
[](example.stdout.txt)
Use data-capture-err="file.txt" to capture stderr
Many instances of CodeBlocks just need a quick set-up command, or perhaps a follow-up tear-down statement. Although, for visibility, any such commands should be included within the document block.
~~~{data-preamble="convert rose: rose.png" data-postamble="convert example.stdout.txt info.txt.gif"}
identify -verbose rose.png > example.stdout.txt
~~~
Pandoc offers the ability to define custom document writers. For image generation, we can ignore all document elements except CodeBlocks, and determine expected behavior by evaluating the attributes of given element.
The custom document writer can be found @ _writers/script.lua, and is expected to be a "work-in-progress" for the near future.