Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andorsk/d2-mode
emacs major mode for d2 graphs
https://github.com/andorsk/d2-mode
d2 elisp emacs graph processes tools
Last synced: about 18 hours ago
JSON representation
emacs major mode for d2 graphs
- Host: GitHub
- URL: https://github.com/andorsk/d2-mode
- Owner: andorsk
- License: gpl-3.0
- Created: 2022-11-22T14:42:04.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-09T21:56:55.000Z (about 1 month ago)
- Last Synced: 2025-01-13T13:20:20.793Z (9 days ago)
- Topics: d2, elisp, emacs, graph, processes, tools
- Language: Emacs Lisp
- Homepage:
- Size: 3.73 MB
- Stars: 75
- Watchers: 2
- Forks: 8
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![MELPA](https://melpa.org/packages/d2-mode-badge.svg)](https://melpa.org/#/d2-mode)
[![build](https://github.com/andorsk/d2-mode/actions/workflows/build.yml/badge.svg)](https://github.com/andorsk/d2-mode/actions/workflows/build.yml)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)# d2-mode
A [d2](https://github.com/terrastruct/d2) extension for Emacs. This was heavily
inspired of [Mermaid Mode](https://github.com/abrochard/mermaid-mode).**Status:** Alpha. Available on Melpa.
It works you can use this to render d2 in both your browser and in an emacs buffer. See [Bugs & Issues](#bugs--issues) for known issues.
**Table of Contents**
- [d2-mode](#d2-mode)
- [Why D2](#why-d2)
- [Installation](#installation)
- [Usage](#usage)
- [Customization](#customization)
- [`d2` binary location](#d2-binary-location)
- [Output format](#output-format)
- [Temp directory](#temp-directory)
- [Key bindings](#key-bindings)
- [Bonus](#bonus)
- [Roadmap](#roadmap)
- [Bugs & Issues](#bugs--issues)
- [Contributors](#contributors)## Why D2
Text to graph diagrams are awesome. I used Mermaid.js all the time and it was
fantastic, but there were a few things it couldn't do so I wanted to expand my
options.Some things that I've noticed d2 has some interesting support in:
1. More themes
2. Code Blocks
3. More visual customization
4. More graph support
5. AutoformatLearn more about [d2 here](https://d2lang.com/tour/intro/)
## Installation
1. Load the d2-mode.el file or install from melpa: `M-x package-install d2-mode`
2. Install d2 binary from the d2 project if you plan to compile graphs in Emacs## Usage
```text
C-c C-c - compile current file to an image
C-c C-f - compile given file to an image
C-c C-b - compile current buffer to an image
C-c C-r - compile current region to an image
C-c C-o - open in the live editor
C-c C-d - open the official doc
```Note: All compile commands will open the output in a buffer to view the resulting image.
## Customization
### `d2` binary location
You can specify the location of `d2` with the variable `d2-location`, the default assumes you have the binary in your `PATH` (and for that you probably want/need to install [`d2`](https://github.com/andorsk/d2-mode)).
### Output format
You can specify png or svg output format by putting this in your `init.el` file:
```(setq d2-output-format "
Also thank you to @suliveevil for bringing up issues.