It also uses Pandoc, so supports lots of input and output formats (Markdown, LaTeX, HTML, etc.). For example, this Markdown will generate a list of numbers, along with a code listing:
The following list:
```{.unwrap pipe="tee example.py | python3 | pandoc -f md -t json"}
for i in range(10):
print(' - ' + str(i))
```
Was generated using this code:
```{.python pipe="cat example.py"}
```
The first code block gets run through the command given by `pipe`: that saves a copy of the code to `example.py`, interprets it using `python3`, then uses `pandoc` to convert the generated Markdown to "Pandoc JSON" format. That JSON replaces the original contents of the code block, and the `.unwrap` tells Pandoc to replace the code block with its contents (parsed as Pandoc JSON).The second code block gets run through the command `cat example.py`, which ignores its input (which is empty anyhow), and dumps out the `example.py` file that was generated by the first code block. The `.python` tells Pandoc to syntax-highlight this block as Python code.