From 0769012d60ab5b8cdf7081b3cc2b82230f0acaeb Mon Sep 17 00:00:00 2001 From: Caleb B Date: Fri, 27 Feb 2026 14:20:18 +1000 Subject: [PATCH] Adds Preview and Save to png tasks Adds 2 new tasks, Preview which will create an svg in the same folder as the d2 file and open it in a web browser for live previews as the d2 file is updates and Save to png which will export a png in the same location as the d2 file. I considered using Export to png instead of Save to png but that would move Preview below it in the Tasks list and I thought it better to have preview be at the top of the list. --- languages/d2/tasks.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 languages/d2/tasks.json diff --git a/languages/d2/tasks.json b/languages/d2/tasks.json new file mode 100644 index 0000000..a4f155b --- /dev/null +++ b/languages/d2/tasks.json @@ -0,0 +1,15 @@ +[ + { + "label": "Preview", + "command": "d2 -w \"$ZED_FILE\" \"$ZED_DIRNAME/$ZED_STEM.svg\"", + "use_new_terminal": true, + "allow_concurrent_runs": true, + "reveal": "no_focus" + }, + { + "label": "Save to png", + "command": "d2 \"$ZED_FILE\" \"$ZED_DIRNAME/$ZED_STEM.png\"", + "use_new_terminal": false, + "allow_concurrent_runs": false + } +]