Skip to content

kzikit/slidev-addon-d2-diagram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

Install the addon with npm:

npm install slidev-addon-d2-diagram

Usage

Enable the addon in your Slidev slides.md frontmatter:

---
addons:
  - slidev-addon-d2-diagram
---

D2 Diagram Support

To create a D2 diagram, start a code block with ``` and enter d2 to activate the D2 diagram drawing feature.

```d2
direction: right
a -> b -> c

b: {
  direction: right
  1 -> 2 -> 3
}

a: {
  direction: left
  foo -> bar
}
```

Custom Options

Add a space after the language tag ```d2 and input { key1: value1, key2: value2 }.

  • Supported options:
    1. layout: Layout engine to use ('dagre' | 'elk') [default: 'elk'].
    2. themeID: Theme ID to use [default: 0].
    3. sketch: Enable sketch mode [default: false].
```d2 { layout: dagre, themeID: 300, sketch: true }
direction: right
a -> b -> c

b: {
  direction: right
  1 -> 2 -> 3
}

a: {
  direction: left
  foo -> bar
}
```

About

Slidev addon to show d2 diagrams

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors