Render Kroki diagrams in Quarto documents (HTML and PDF).
This uses the Kroki HTTP API via curl
, doing a POST request.
quarto add fermarsan/quarto-kroki
This will install the extension under the _extensions
subdirectory.
Here is how you add the filter to a page (it can also be added to a _quarto.yml
project file with
the same syntax):
---
title: "My Document"
filters:
- quarto-kroki
---
And then add the following markdown in your quarto file:
```kroki-<diagram_kind>
diagram code
```
for instance:
```kroki-graphviz
digraph G {
Hello -> World
}
```
or
```kroki-ditaa
+---------+ +---------+
| Hello |--->| World |
+---------+ +---------+
```
Make sure you have curl
is installed and available in your PATH.
There are two source code minimal examples:
-
test.qmd "HTML"
-
test_pdf.qmd "pdf"
If the pdf output format is enabled, you can insert Kroki diagrams via inkscape
:
---
title: "My Document"
filters:
- quarto-kroki
format: pdf
---
In that case make sure you have inkscape
installed and available in your PATH.