https://github.com/fliiiix/pandoc-d2-filter
Pandoc filter to covert d2 code blocks to images.
https://github.com/fliiiix/pandoc-d2-filter
d2 hacktoberfest pandoc-filter
Last synced: about 1 year ago
JSON representation
Pandoc filter to covert d2 code blocks to images.
- Host: GitHub
- URL: https://github.com/fliiiix/pandoc-d2-filter
- Owner: fliiiix
- License: mit
- Created: 2024-10-06T14:33:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-16T19:12:58.000Z (over 1 year ago)
- Last Synced: 2025-02-04T18:20:26.879Z (over 1 year ago)
- Topics: d2, hacktoberfest, pandoc-filter
- Language: Python
- Homepage: https://pypi.org/project/pandoc-d2-filter/
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pandoc-d2-filter
================
Pandoc filter to convert d2 code blocks to images.
````
```{.d2 pad=20}
x -> y
```
````
## Usage
Install it with pip:
```
pip install pandoc-d2-filter
```
And use it like any other pandoc filter:
```
pandoc tests/testdata/default.md -o default.pdf --filter pandoc-d2
```
The d2 binary is either part of the `$PATH`
or can be configured via `D2_BIN` environment variable.
If you use other output formats than svg,
you should `d2 init-playwright` before the first use.
## Configuration
TODO check `tests/testdata` for now.
## Inspiration
This filter is heavily inspired by the
[JavaScript d2-filter](https://github.com/ram02z/d2-filter)
and the [pandoc-plantuml-filter](https://github.com/timofurrer/pandoc-plantuml-filter).
Thanks [Omar](https://github.com/ram02z) & [Timo](https://github.com/timofurrer)