Reference

Pandoc::Filter::ImagesFromCode(3pm)

transform code blocks into images

NAME

Pandoc::Filter::ImagesFromCode - transform code blocks into images

DESCRIPTION

This Pandoc::Filter transforms CodeBlock elements into Image elements. Content of transformed code section and resulting image files are written to files.

Attribute "title" is mapped to the image title and attribute "caption" to an image caption, if available.

CONFIGURATION

from

File extension of input files extracted from code blocks. Defaults to "code".

to

File extension of created image files. Can be a fixed string or a code reference that gets the document output format (for instance latex or "html") as argument to produce different image formats depending on output format.

name

Code reference that maps the CodeBlock element to a filename (without directory and extension). By default the element's "id" is used if it contains characters no other than "a-zA-Z0-9_-". Otherwise the name is the MD5 hash of the element's content.

dir

Directory where to place input and output files, relative to the current directory. This directory (default ".") is prepended to all image references in the target document.

run

Command to transform input files to output files. Variable references "$...$" can be used to refer to current values of "from", "to", "name", "dir", "infile" and "outfile". Example:

  run => ['ditaa', '-o', '$infile$', '$outfile$'],

capture

Capture output of command and write it to "outfile". Disabled by default.

force

Apply transformation also if input and output file already exists unchanged. Disabled by default.

History