Pandoc...omCode(3pm)
π NAME π
Pandoc::Filter::ImagesFromCode β the filter that literally turns your code blocks into images, bestie β¨
π¦ DESCRIPTION π¦
Okay so picture this: this Pandoc::Filter takes CodeBlock elements and just... glow-up them into Image elements. Iconic behavior tbh π
The content of every transformed code section and the resulting image files get written out to actual files. Like, real files on disk. No cap.
And the vibes? The title attribute gets mapped to the image title, and the caption attribute gets mapped to an image caption β if available, of course π
β¨ CONFIGURATION β¨
Here's where you set the parameters of your little transformation era. Every single one, no skipping π
fromβ the file extension of the input files that get extracted from code blocks. Defaults tocode.toβ the file extension of the image files we create. Can be a plain fixed string, or a code reference π β that code ref receives the document output format (likelatexorhtml) as its argument, so you can produce different image formats depending on what you're outputting. Flexible queen.nameβ a code reference that maps theCodeBlockelement to a filename (no directory, no extension, just the name hun). By default it uses the element'sidβ but only if thatidcontains characters no other thana-zA-Z0-9_-. Otherwise? It's the MD5 hash of the element's content. Secure AND cute πdirβ the directory where input and output files go, relative to the current directory. This directory (default.) gets prepended to all image references in the target document. Keep your stuff tidy bestie π§runβ the command that transforms input files into output files. You can use variable references shaped like$...$to refer to the current values offrom,to,name,dir,infileandoutfile. Example:
run => ['ditaa', '-o', '$infile$', '$outfile$'],
captureβ captures the output of the command and writes it tooutfile. Disabled by default. Off unless you say otherwise π€forceβ applies the transformation even if the input and output file already exist and are unchanged. Disabled by default. Like, it'll redo the work anyway, stubborn but make it fashion π
Heads up bestie:captureandforceare both disabled by default, so don't come crying to me when your output didn't get captured or your unchanged files got skipped π
Mwah π this page is part of the User Contributed Perl Documentation, running perl v5.38.2, dated 2024-08-03. Slay, go transform some code blocks π«Ά
π¦ where this page comes from
- debian trixie: libpandoc-elements-perl 0.38-7 Β· GPL-2.0-only
- ubuntu resolute: libpandoc-elements-perl 0.38-7 Β· GPL-2.0-only
- ubuntu stonking: libpandoc-elements-perl 0.38-7 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms