(defun d2-format-buffer ()
  "Run prettier."
  (interactive)
  (run-command-on-buffer-require-output "d2" "fmt" "-")
  )

(use-package d2-mode
  :commands (d2-mode)
  :hook (
         (d2-mode . (lambda ()
                      (add-hook 'before-save-hook 'd2-format-buffer nil 'local)
                      ))
         )
  )

(provide 'lang-d2)
