{"id":13761093,"url":"https://github.com/CDSoft/panda","last_synced_at":"2025-05-10T12:30:44.489Z","repository":{"id":43205837,"uuid":"334370520","full_name":"CDSoft/panda","owner":"CDSoft","description":"Panda is a Pandoc Lua filter that works on internal Pandoc's AST. Panda is heavily inspired by [abp](http:/cdelord.fr/abp) reimplemented as a Pandoc Lua filter.","archived":false,"fork":false,"pushed_at":"2024-07-26T16:45:18.000Z","size":206,"stargazers_count":41,"open_issues_count":1,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-03T13:05:59.196Z","etag":null,"topics":["lua","pandoc","pandoc-filter","text-preprocessing"],"latest_commit_sha":null,"homepage":"https://cdelord.fr/panda","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CDSoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"CDSoft"}},"created_at":"2021-01-30T09:01:39.000Z","updated_at":"2024-08-03T13:06:06.070Z","dependencies_parsed_at":"2023-11-15T09:26:49.005Z","dependency_job_id":"97aaca83-de14-47f4-8db2-7add2333f716","html_url":"https://github.com/CDSoft/panda","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CDSoft%2Fpanda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CDSoft%2Fpanda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CDSoft%2Fpanda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CDSoft%2Fpanda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CDSoft","download_url":"https://codeload.github.com/CDSoft/panda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224957946,"owners_count":17398494,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","pandoc","pandoc-filter","text-preprocessing"],"created_at":"2024-08-03T13:01:38.070Z","updated_at":"2025-05-10T12:30:44.456Z","avatar_url":"https://github.com/CDSoft.png","language":"Lua","readme":"# About panda\n\nPanda is a [Pandoc Lua filter](http://pandoc.org/lua-filters.html) that\nworks on internal Pandoc’s AST.\n\nIt provides several interesting features:\n\n- variable expansion (minimalistic templating)\n- conditional blocks\n- file inclusion (e.g. for source code examples)\n- script execution (e.g. to include the result of a command)\n- diagrams ([Graphviz](http://graphviz.org/),\n  [PlantUML](http://plantuml.sourceforge.net/),\n  [ditaa](http://ditaa.sourceforge.net/),\n  [Asymptote](http://asymptote.sourceforge.net/),\n  [blockdiag](http://blockdiag.com/),\n  [mermaid](https://mermaidjs.github.io/)…)\n\nPanda is heavily inspired by [abp](https://codeberg.org/cdsoft/abp)\nreimplemented as a [Pandoc Lua\nfilter](http://pandoc.org/lua-filters.html).\n\nIf you need a more generic text preprocessor,\n[ypp](https://codeberg.org/cdsoft/ypp \"Yet a PreProcessor\") may be a\nbetter choice.\n\n## Pricing\n\nPanda is a free and open source software. But it has a cost. It takes\ntime to develop, maintain and support.\n\nTo help Panda remain free, open source and supported, users are\ncordially invited to contribute financially to its development.\n\n| Panda price        | Europe        | United States | Rest of the World |\n|--------------------|---------------|---------------|-------------------|\n| Personal usage     | Free donation | Free donation | Free donation     |\n| Academic usage     | €10 or more   | \\$20 or more  | \\$15 or more      |\n| Professional usage | €20 or more   | \\$40 or more  | \\$25 or more      |\n\nThese prices are per month and per tools (see [`PRICING`](PRICING)).\n\n\u003ca href='https://liberapay.com/LuaX/donate' target='_blank'\u003e\u003cimg height='36' style='border:0px;height:36px;' src='https://liberapay.com/assets/widgets/donate.svg' border='0' alt='Donate using Liberapay' /\u003e\u003c/a\u003e\n\u003ca href='https://ko-fi.com/K3K11CD108' target='_blank'\u003e\u003cimg height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi6.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\n\nFeel free to promote Panda!\n\n# Open source\n\n[Panda](https://codeberg.org/cdsoft/panda \"Pandoc add-ons (Lua filters for Pandoc)\")\nis an Open source software. Anybody can contribute on\n[Codeberg](https://codeberg.org/cdsoft/panda) to:\n\n- suggest or add new features\n- report or fix bugs\n- improve the documentation\n- add some nicer examples\n- find new usages\n- …\n\n# Installation\n\nInstalling Panda from sources requires [Ninja](https://ninja-build.org),\n[LuaX](https://codeberg.org/cdsoft/luax \"Lua eXtended interpretor\") and\n[Bang](https://codeberg.org/cdsoft/bang \"Ninja file generator\").\n\n1.  Download the sources: `git clone https://codeberg.org/cdsoft/panda`.\n2.  Run `bang` to generate `build.ninja`.\n3.  Run `ninja test` to run tests.\n4.  Run `ninja install` to install `panda` and `panda.lua` to\n    `~/.local/bin` or `PREFIX=prefix ninja install` to install `panda`\n    and `panda.lua` to `prefix/bin`\n\n`panda` and `panda.lua` can also be installed anywhere. Nothing else is\nrequired (except from [Pandoc](http://pandoc.org/) obviously).\n\n# Usage\n\n`panda.lua` is a [Pandoc Lua filter](http://pandoc.org/lua-filters.html)\nand is not meant to be called directly. `panda` is just a shell script\nthat calls `pandoc -L panda.lua ...`.\n\n``` sh\n$ pandoc -L panda.lua ...\n```\n\nor\n\n``` sh\n$ panda ...\n```\n\nA complete example is given as a Makefile in the doc directory.\n\n# Cheat sheet\n\n| Syntactic item | Class | Attributes | Description |\n|----|----|----|----|\n| any string |  |  | `{{var}}` is replaced by the value of `var` if it is defined (variables can be environment variables or Lua variables) |\n| any block | `comment` |  | commented block |\n| any block |  | `include=file` | replaces the div block with the content of `file` (rendered according to its format) |\n| div block |  | `doc=file` `from=start_pattern` `to=end_pattern` | replaces the div block with text blocks from `file` (rendered according to its format). Blocks are separated by the patterns `from` and `to` (`@@@` is the default separator). |\n| div block, code block |  | `shift=n` | adds `n` to header levels in an imported div block |\n| div block, code block |  | `pattern=\"Lua string pattern\"` `format=\"output format\"` | applies a Lua string pattern to the content of the file. The emitted text is `format`. `format` may contain captures from `pattern`. |\n| code block | `meta` |  | definitions for the string expansion (Lua script), defined in the code block |\n| any block, any inline | `if` | `name=val` | block emitted only if `name`’s value is `val` |\n| code block, inline code |  | `include=file` | replaces the code block content with the content of `file` |\n| code block, inline code |  | `fromline=n` `from=n` | includes a file from line number `n` |\n| code block, inline code |  | `toline=n` `to=n` | includes a file up to line number `n` |\n| code block, inline code |  | `cmd=\"shell command\"` `icmd=\"shell command\"` | replaces the code block by the result of the shell command. With`icmd` the code block content is parsed by Pandoc and included in a Div block. |\n| code block |  | `render=\"command\"` | replaces the code block by a link to the image produced by the command (`%i` is the input file name, its content is the content of the code block, `%o` is the output file name) |\n\n# Commented blocks\n\nDiv blocks with the `comment` class are commented:\n\n``` markdown\n::: comment\nThis block is a comment and is discarded by panda.\n:::\n```\n\n# String expansion\n\n`panda` stores variables in an environment used to expand strings.\nVariables can be defined by a Lua script with the `meta` class. The\n`include` attribute can also be used to point to an external file.\nVariables can only contain inline elements, not blocks.\n\nThe initial environment contains:\n\n- the environment variables\n- the document metadata (title, author, date)\n- `vars` alias of `PANDOC_WRITER_OPTIONS.variables` to access pandoc\n  variables given on the command line\n\nVariable names are enclosed between double curly brackets.\n\nE.g.:\n\n```` markdown\n```meta\nfoo = \"bar (note: this is parsed as **Markdown**)\"\n```\n\nfoo is {{foo}}.\n````\n\n```` markdown\n```{.meta include=foo.lua}\nThis text is ignored, definitions are in foo.lua.\n```\n\nfoo is defined in `foo.lua` and is {{foo}}.\n````\n\n`meta` code blocks contain Lua code executed by the Pandoc Lua\ninterpretor. Panda also contains the\n[LuaX](https://codeberg.org/cdsoft/luax \"Lua eXtended interpretor\")\nmodules reimplemented in Lua. More details are available in the \\[Luax\ndocumentation\\].\n\n# Conditional blocks\n\nBlocks can be conditionally kept or omitted. The condition is described\nwith attributes.\n\n``` markdown\n:::{.if name=\"value\"}\nThis block is emitted only if the value of the variable \"name\" is \"value\"\n:::\n```\n\n# Div inclusion\n\nFragments of documents can be imported from external files. The\n`include` attribute contains the name of the file to include. The\ncontent of the file is parsed according to its format (deduced from its\nname) and replaces the div block content.\n\n``` markdown\n:::{include=file.md shift=n}\nThis text is optional and will be replaced by the content of file.md.\nSection title levels are shifted by n (0 if not specified).\n:::\n```\n\nThe included file can be in a different format (e.g. a markdown file can\ninclude a reStructuredText file).\n\nIf the block has an input format as a class, the file is parsed\naccording to this format.\n\n# Block inclusion\n\nCode examples can be imported from external files. The `include`\nattribute contains the name of the file to include. The content of the\nfile replaces the code block content.\n\n```` markdown\n```{.c include=foo.c fromline=3 toline=10 pattern=\"Lua string pattern\" format=\"%1\"}\nThis text is optional and will be replaced by the content of foo.c.\n```\n````\n\nThe optional `fromline` and `toline` defines the first and last lines to\nbe included.\n\nThe optional pattern describes the part of the text that will be\nrendered. The format uses the captures defined by the pattern to format\nthe content of the block (`\"%1\"` if not defined).\n\nIf the block has an input format as a class, its result is parsed\naccording to this format.\n\n# Documentation extraction\n\nDocumentation fragments can be extracted from other source code files.\nThe `doc` attribute contains the name of the file where documentation is\nextracted. All the documentation blocks are extracted, concatenated and\nparsed. The result replaces the div block content.\n\n``` markdown\n:::{doc=file.h shift=n from=\"@@@\" to=\"@@@\"}\nThis text is optional and will be replaced by the content of file.h\nwhich is delimited by @@@.\nSection title levels are shifted by n (0 if not specified).\n:::\n```\n\n# Scripts\n\nScripts can be executed by inline or code blocks. The `cmd` attribute\ndefines the command to execute. The content of the block is in a\ntemporary file which name is added to the command. If the command\ncontains the `%s` char, it is replaced by the temporary file name. If\nthe command does not contain any `%s`, the file name is appended to the\ncommand. The result replaces the content of the code block.\n\n`icmd` can be used instead of `cmd` to let Pandoc parse the result of\nthe command and include it in the document as a Span or Div node.\n\nAn explicit file extension can be given after `%s` for languages that\nrequire specific file extensions (e.g. `%s.fs` for F#).\n\n\u003ctable\u003e\n\u003ccolgroup\u003e\n\u003ccol style=\"width: 50%\" /\u003e\n\u003ccol style=\"width: 50%\" /\u003e\n\u003c/colgroup\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eSource\u003c/th\u003e\n\u003cth\u003eResult\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cdiv class=\"sourceCode\" id=\"cb1\"\u003e\u003cpre\nclass=\"sourceCode markdown\"\u003e\u003ccode class=\"sourceCode markdown\"\u003e\u003cspan id=\"cb1-1\"\u003e\u003ca href=\"#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```{.python cmd=python}\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-2\"\u003e\u003ca href=\"#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003eprint(\u0026quot;Hello from Python!\u0026quot;)\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-3\"\u003e\u003ca href=\"#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cdiv class=\"sourceCode\" id=\"cb2\"\u003e\u003cpre\nclass=\"sourceCode python\"\u003e\u003ccode class=\"sourceCode python\"\u003e\u003cspan id=\"cb2-1\"\u003e\u003ca href=\"#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003eHello \u003cspan class=\"im\"\u003efrom\u003c/span\u003e Python\u003cspan class=\"op\"\u003e!\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cdiv class=\"sourceCode\" id=\"cb3\"\u003e\u003cpre\nclass=\"sourceCode markdown\"\u003e\u003ccode class=\"sourceCode markdown\"\u003e\u003cspan id=\"cb3-1\"\u003e\u003ca href=\"#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003eLua says \u003cspan class=\"in\"\u003e`print \u0026quot;Hello from Lua!\u0026quot;`\u003c/span\u003e{icmd=lua}\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\n\u003ctd\u003eLua says Hello from Lua!\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\nNote: `{.python cmd=python}` is equivalent to\n`{.python cmd=\"python %s\"}` and `{.python cmd=\"python %s.py\"}`.\n\n# Diagrams\n\nCode blocks containing diagrams are replaced with an image resulting\nfrom the diagram source code.\n\nThe render command is the `render` field. The output image name is a\nhash computed from the diagram source code.\n\nThe description of the image is in the `caption` and `alt` fields.\n`caption` is the caption of the diagram. `alt` is the alternative\ndescription of the diagram. The optional `target` field is a URL pointed\nby the image.\n\nIn the `render` command, `%i` is replaced by the name of the input\ndocument (generated from the content of the code block) and `%o` by the\nname of the output image file.\n\nImages are generated in a directory given by:\n\n- the environment variable `PANDA_IMG` if it is defined\n- the directory name of the output file if the Pandoc output is a file\n- the `img` directory in the current directory\n\nThe file format (extension) must be in the `render` field, after the\n`%o` tag (e.g.: `%o.png`).\n\nIf the program requires a specific input file extension, it can be\nspecified in the `render` field, after the `%i` tag (e.g.: `%i.xyz`).\n\nOptional fields can be given to set some options:\n\n- `name` defines the name of the image file. This can help distributing\n  documents with user friendly image names.\n\n\u003ctable\u003e\n\u003ccolgroup\u003e\n\u003ccol style=\"width: 44%\" /\u003e\n\u003ccol style=\"width: 55%\" /\u003e\n\u003c/colgroup\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eSource\u003c/th\u003e\n\u003cth\u003eResult\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cdiv class=\"sourceCode\" id=\"cb1\"\u003e\u003cpre\nclass=\"sourceCode markdown\"\u003e\u003ccode class=\"sourceCode markdown\"\u003e\u003cspan id=\"cb1-1\"\u003e\u003ca href=\"#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e``` { render=\u0026quot;{{plantuml}}\u0026quot;\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-2\"\u003e\u003ca href=\"#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e      caption=\u0026quot;Caption\u0026quot;\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-3\"\u003e\u003ca href=\"#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e      alt=\u0026quot;Alternative description\u0026quot; }\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-4\"\u003e\u003ca href=\"#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e@startuml\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-5\"\u003e\u003ca href=\"#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003eAlice -\u0026gt; Bob: hello\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-6\"\u003e\u003ca href=\"#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e@enduml\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-7\"\u003e\u003ca href=\"#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cp\u003e\u003cimg src=\"./img/alice_and_bob.svg\" title=\"Caption\"\nalt=\"Alternative description\" /\u003e\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\nSome render commands are predefined:\n\n| Diagram | Predefined variable | Render command |\n|:---|:---|:---|\n| [GraphViz](http://graphviz.org/) | `dot` | `dot -Tsvg -o %o.svg %i` |\n|  | `dot.svg` | `dot -Tsvg -o %o.svg %i` |\n|  | `dot.png` | `dot -Tpng -o %o.png %i` |\n|  | `dot.pdf` | `dot -Tpdf -o %o.pdf %i` |\n| [PlantUML](http://plantuml.sourceforge.net/) | `plantuml` | `java -jar .build/plantuml.jar -pipe -charset UTF-8 -tsvg \u003c %i \u003e %o.svg` |\n|  | `plantuml.svg` | `java -jar .build/plantuml.jar -pipe -charset UTF-8 -tsvg \u003c %i \u003e %o.svg` |\n|  | `plantuml.png` | `java -jar .build/plantuml.jar -pipe -charset UTF-8 -tpng \u003c %i \u003e %o.png` |\n|  | `plantuml.pdf` | `java -jar .build/plantuml.jar -pipe -charset UTF-8 -tpdf \u003c %i \u003e %o.pdf` |\n| [Asymptote](http://asymptote.sourceforge.net/) | `asy` | `asy -f svg -o %o.svg %i` |\n|  | `asy.svg` | `asy -f svg -o %o.svg %i` |\n|  | `asy.png` | `asy -f png -o %o.png %i` |\n|  | `asy.pdf` | `asy -f pdf -o %o.pdf %i` |\n| [blockdiag](http://blockdiag.com/) | `blockdiag` | `blockdiag -a -Tsvg -o %o.svg %i` |\n|  | `blockdiag.svg` | `blockdiag -a -Tsvg -o %o.svg %i` |\n|  | `blockdiag.png` | `blockdiag -a -Tpng -o %o.png %i` |\n|  | `blockdiag.pdf` | `blockdiag -a -Tpdf -o %o.pdf %i` |\n| [mermaid](https://mermaidjs.github.io/) | `mmdc` | `mmdc --pdfFit -i %i -o %o.svg` |\n|  | `mmdc.svg` | `mmdc --pdfFit -i %i -o %o.svg` |\n|  | `mmdc.png` | `mmdc --pdfFit -i %i -o %o.png` |\n|  | `mmdc.pdf` | `mmdc --pdfFit -i %i -o %o.pdf` |\n| [ditaa](http://ditaa.sourceforge.net/) | `ditaa` | `java -jar .build/ditaa.jar --svg -o -e UTF-8 %i %o.svg` |\n|  | `ditaa.svg` | `java -jar .build/ditaa.jar --svg -o -e UTF-8 %i %o.svg` |\n|  | `ditaa.png` | `java -jar .build/ditaa.jar  -o -e UTF-8 %i %o.png` |\n| [gnuplot](http://www.gnuplot.info/) | `gnuplot` | `gnuplot -e 'set terminal svg' -e 'set output \"%o.svg\"' -c %i` |\n|  | `gnuplot.svg` | `gnuplot -e 'set terminal svg' -e 'set output \"%o.svg\"' -c %i` |\n|  | `gnuplot.png` | `gnuplot -e 'set terminal png' -e 'set output \"%o.png\"' -c %i` |\n|  | `gnuplot.pdf` | `gnuplot -e 'set terminal pdf' -e 'set output \"%o.pdf\"' -c %i` |\n| [lsvg](https://codeberg.org/cdsoft/lsvg/) | `lsvg` | `lsvg %i.lua -o %o.svg` |\n|  | `lsvg.svg` | `lsvg %i.lua -o %o.svg` |\n|  | `lsvg.png` | `lsvg %i.lua -o %o.png` |\n|  | `lsvg.pdf` | `lsvg %i.lua -o %o.pdf` |\n\nNotes:\n\n- `dot`: [GraphViz](http://graphviz.org/) support also includes `dot`,\n  `neato`, `twopi`, `circo`, `fdp`, `sfdp`, `patchwork` and `osage`.\n\n- `plantuml`: `PLANTUML` can be defined as an environment variable. Its\n  default value is the directory of the `panda.lua` script appended with\n  `\"plantuml.jar\"`.\n\n- `ditaa`: `DITAA` can be defined as an environment variable. Its\n  default value is the directory of the `panda.lua` script appended with\n  `\"ditaa.jar\"`.\n\n- `blockdiag`: [Blockdiag](http://blockdiag.com/) support also includes\n  `actdiag`, `blockdiag`, `nwdiag`, `packetdiag`, `rackdiag` and\n  `seqdiag`.\n\n- renderers without an explicit image format are built differently\n  according to the output document format.\n\n  - For PDF (LaTeX) documents, the default format is PDF\n  - For other documents, the default format is SVG\n\nE.g.:\n\n\u003ctable\u003e\n\u003ccolgroup\u003e\n\u003ccol style=\"width: 44%\" /\u003e\n\u003ccol style=\"width: 55%\" /\u003e\n\u003c/colgroup\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eSource\u003c/th\u003e\n\u003cth\u003eResult\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cdiv class=\"sourceCode\" id=\"cb1\"\u003e\u003cpre\nclass=\"sourceCode markdown\"\u003e\u003ccode class=\"sourceCode markdown\"\u003e\u003cspan id=\"cb1-1\"\u003e\u003ca href=\"#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```{.dot render=\u0026quot;{{dot}}\u0026quot;}\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-2\"\u003e\u003ca href=\"#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003edigraph {\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-3\"\u003e\u003ca href=\"#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e    rankdir=LR;\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-4\"\u003e\u003ca href=\"#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e    input -\u0026gt; pandoc -\u0026gt; output\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-5\"\u003e\u003ca href=\"#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e    pandoc -\u0026gt; panda -\u0026gt; {pandoc, diagrams}\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-6\"\u003e\u003ca href=\"#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e    { rank=same; pandoc, panda }\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-7\"\u003e\u003ca href=\"#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e    { rank=same; diagrams, output }\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-8\"\u003e\u003ca href=\"#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e}\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-9\"\u003e\u003ca href=\"#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cp\u003e\u003cimg src=\"./img/panda.svg\" class=\"dot\" /\u003e\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cdiv class=\"sourceCode\" id=\"cb2\"\u003e\u003cpre\nclass=\"sourceCode markdown\"\u003e\u003ccode class=\"sourceCode markdown\"\u003e\u003cspan id=\"cb2-1\"\u003e\u003ca href=\"#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```{ render=\u0026quot;{{gnuplot}}\u0026quot;}\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb2-2\"\u003e\u003ca href=\"#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003eset xrange [-pi:pi]\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb2-3\"\u003e\u003ca href=\"#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003eset yrange [-1.5:1.5]\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb2-4\"\u003e\u003ca href=\"#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003eplot sin(x) lw 4, cos(x) lw 4\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb2-5\"\u003e\u003ca href=\"#cb2-5\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cp\u003e\u003cimg src=\"./img/gnuplot.svg\" /\u003e\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\nFilters can be combined. E.g.: a diagram can be stored in an external\nfile, included and rendered by `panda`.\n\n\u003ctable\u003e\n\u003ccolgroup\u003e\n\u003ccol style=\"width: 50%\" /\u003e\n\u003ccol style=\"width: 50%\" /\u003e\n\u003c/colgroup\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth\u003eSource\u003c/th\u003e\n\u003cth\u003eResult\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cdiv class=\"sourceCode\" id=\"cb1\"\u003e\u003cpre\nclass=\"sourceCode markdown\"\u003e\u003ccode class=\"sourceCode markdown\"\u003e\u003cspan id=\"cb1-1\"\u003e\u003ca href=\"#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003eThe file \u003cspan class=\"in\"\u003e`hello.dot`\u003c/span\u003e contains:\u003c/span\u003e\n\u003cspan id=\"cb1-2\"\u003e\u003ca href=\"#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-3\"\u003e\u003ca href=\"#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```{.dot include=\u0026quot;path/hello.dot\u0026quot;\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-4\"\u003e\u003ca href=\"#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e         pattern=\u0026quot;digraph%s*%b{}\u0026quot; }\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb1-5\"\u003e\u003ca href=\"#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cp\u003eThe file \u003ccode\u003ehello.dot\u003c/code\u003e contains:\u003c/p\u003e\n\u003cdiv class=\"sourceCode\" id=\"cb2\"\u003e\u003cpre\nclass=\"sourceCode dot\"\u003e\u003ccode class=\"sourceCode dot\"\u003e\u003cspan id=\"cb2-1\"\u003e\u003ca href=\"#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"kw\"\u003edigraph\u003c/span\u003e \u003cspan class=\"ot\"\u003e{\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb2-2\"\u003e\u003ca href=\"#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"co\"\u003e    \u003c/span\u003e\u003cspan class=\"at\"\u003erankdir\u003c/span\u003e\u003cspan class=\"ot\"\u003e=\u003c/span\u003e\u003cspan class=\"va\"\u003eLR\u003c/span\u003e\u003cspan class=\"ot\"\u003e;\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb2-3\"\u003e\u003ca href=\"#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"co\"\u003e    \u003c/span\u003e\u003cspan class=\"va\"\u003eHello\u003c/span\u003e\u003cspan class=\"co\"\u003e \u003c/span\u003e\u003cspan class=\"ot\"\u003e-\u0026gt;\u003c/span\u003e\u003cspan class=\"co\"\u003e \u003c/span\u003e\u003cspan class=\"va\"\u003eWorld\u003c/span\u003e\u003cspan class=\"ot\"\u003e;\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb2-4\"\u003e\u003ca href=\"#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"ot\"\u003e}\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cdiv class=\"sourceCode\" id=\"cb3\"\u003e\u003cpre\nclass=\"sourceCode markdown\"\u003e\u003ccode class=\"sourceCode markdown\"\u003e\u003cspan id=\"cb3-1\"\u003e\u003ca href=\"#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"an\"\u003eand is rendered as:\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb3-2\"\u003e\u003ca href=\"#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan id=\"cb3-3\"\u003e\u003ca href=\"#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```{ render=\u0026quot;{{dot}}\u0026quot;\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb3-4\"\u003e\u003ca href=\"#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e     include=\u0026quot;path/hello.dot\u0026quot; }\u003c/span\u003e\u003c/span\u003e\n\u003cspan id=\"cb3-5\"\u003e\u003ca href=\"#cb3-5\" aria-hidden=\"true\" tabindex=\"-1\"\u003e\u003c/a\u003e\u003cspan class=\"in\"\u003e```\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cp\u003eand is rendered as:\u003c/p\u003e\n\u003cp\u003e\u003cimg src=\"./img/hello.svg\" /\u003e\u003c/p\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n# Makefile dependencies\n\nIt is sometimes useful to build a dependency list on the fly. `panda`\ncan generate a dependency list for make, in the same vein than the gcc\n`-M` option. The environment variable `PANDA_TARGET` must be defined\nwith the target name. `panda` will generate a file named\n`${PANDA_TARGET}.d` containing the dependencies of `${PANDA_TARGET}`.\n\nThe dependency filename can be redefined with the environment variable\n`PANDA_DEP_FILE` (e.g. to save the dependency file in a different\ndirectory).\n\n`PANDA_TARGET` and `PANDA_DEP_FILE` can also be defined by the pandoc\nvariables `panda_target` and `panda_dep_file`\n(e.g. `pandoc -Vpanda_target=... -Vpanda_dep_file=...`).\n\nE.g.:\n\n``` sh\nPANDA_TARGET=index.html panda index.md -o index.html\n```\n\nThis will produce a file named `index.html.d` containing\n`index.html: ...`.\n\n# Licenses\n\n## Panda\n\n    Panda is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    Panda is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with Panda.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n\n    For further information about Panda you can visit\n    https://codeberg.org/cdsoft/panda\n\n# Feedback\n\nYour feedback and contributions are welcome. You can contact me at\n[CDSoft](https://cdsoft.codeberg.page).\n","funding_links":["https://github.com/sponsors/CDSoft","https://liberapay.com/LuaX/donate'","https://liberapay.com/assets/widgets/donate.svg'","https://ko-fi.com/K3K11CD108'"],"categories":["Lua"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCDSoft%2Fpanda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCDSoft%2Fpanda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCDSoft%2Fpanda/lists"}