https://github.com/furqansoftware/goldmark-d2
Goldmark extension for D2 diagrams
https://github.com/furqansoftware/goldmark-d2
d2 goldmark goldmark-extension
Last synced: 11 months ago
JSON representation
Goldmark extension for D2 diagrams
- Host: GitHub
- URL: https://github.com/furqansoftware/goldmark-d2
- Owner: FurqanSoftware
- License: mit
- Created: 2022-12-23T05:12:02.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-02-22T04:25:55.000Z (over 2 years ago)
- Last Synced: 2024-06-19T02:10:55.651Z (about 2 years ago)
- Topics: d2, goldmark, goldmark-extension
- Language: Go
- Homepage:
- Size: 543 KB
- Stars: 16
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Goldmark D2
[](https://pkg.go.dev/github.com/FurqanSoftware/goldmark-d2)
Goldmark D2 is a [Goldmark](https://github.com/yuin/goldmark) extension providing diagram support through [D2](https://d2lang.com/).
## Usage
``` go
goldmark.New(
goldmark.WithExtensions(&Extender{
// Defaults when omitted
Layout: d2dagrelayout.Layout,
ThemeID: d2themescatalog.CoolClassics.ID,
}),
).Convert(src, dst)
```
## Example
~~~markdown
The following diagram shows the important link between the letters X and Y:
```d2
x -> y
```
~~~

{Sketch: true}
~~~markdown
```d2
dogs -> cats -> mice: chase
replica 1 <-> replica 2
a -> b: To err is human, to moo bovine {
source-arrowhead: 1
target-arrowhead: * {
shape: diamond
}
}
```
~~~

## To-dos
- [x] Option for hand-drawn rendering
## More Goldmark Extensions
- [Katex](https://github.com/FurqanSoftware/goldmark-katex): math and equation support through [KaTeX](https://katex.org/)