Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.
/ run-d2-filter Public archive

Run d2 from Quarto using existing d2 JSON filter

License

Notifications You must be signed in to change notification settings

cderv/run-d2-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extension For Quarto to run D2-filter


THIS REPO IS NOW ARCHIVED AND YOU SHOULD USE https://github.com/data-intuitive/quarto-d2 INSTEAD with QUARTO


This extension is simply a Lua wrapper to run JSON filter d2-filter which allow to use d2 diagrams in Pandoc

This is a prototype as simple wrapper around an existing filter and not an extension running d2 directly

Future and extended work would be to provide a Lua version of d2-filter

Installing

This extension expects d2 and d2-filter programs to be on PATH.

Installing d2

Follow step at https://d2lang.com/tour/install to run install script.

For Windows user, d2 is available through Scoop (https://scoop.sh/)

scoop install d2

Installing d2-filter

Follow step at https://github.com/ram02z/d2-filter. d2-filter is available as an NPM package and requires Node.js

Installing this extension

quarto add cderv/run-d2-filter

This will install the extension under the _extensions subdirectory. If you're using version control, you will want to check in this directory.

Using

Reminder: To use this filter, d2 and d2-filter are required to be found on PATH

Add to your YAML header or config YAML the filter

filters:
  - run-d2-filter

This Lua filter is only a wrapper that calls pandoc.utils.run_json() on the d2-filter JSON filter.

Example

Here is the source code for a minimal example: example.qmd.

About

Run d2 from Quarto using existing d2 JSON filter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages