Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "src/d2-vscode"]
path = src/d2-vscode
url = https://github.com/terrastruct/d2-vscode
url = https://github.com/d2lang/d2-vscode
[submodule "ci/sub"]
path = ci/sub
url = https://github.com/terrastruct/ci
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# D2 Documentation

[![ci](https://github.com/terrastruct/d2-docs/actions/workflows/ci.yml/badge.svg)](https://github.com/terrastruct/d2-docs/actions/workflows/ci.yml)
[![daily](https://github.com/terrastruct/d2-docs/actions/workflows/daily.yml/badge.svg)](https://github.com/terrastruct/d2-docs/actions/workflows/daily.yml)
[![license](https://img.shields.io/github/license/terrastruct/d2-docs?color=9cf)](./LICENSE)
[![ci](https://github.com/d2lang/d2-docs/actions/workflows/ci.yml/badge.svg)](https://github.com/d2lang/d2-docs/actions/workflows/ci.yml)
[![daily](https://github.com/d2lang/d2-docs/actions/workflows/daily.yml/badge.svg)](https://github.com/d2lang/d2-docs/actions/workflows/daily.yml)
[![license](https://img.shields.io/github/license/d2lang/d2-docs?color=9cf)](./LICENSE)

This is language documentation for D2, a modern, open-source text-to-diagram DSL. The
source repository for that is here:
[https://github.com/terrastruct/d2](https://github.com/terrastruct/d2).
[https://github.com/d2lang/d2](https://github.com/d2lang/d2).

Deployed at [https://d2lang.com](https://d2lang.com).

Expand Down
6 changes: 3 additions & 3 deletions blog/animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This is a single SVG file created purely through D2 text:

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/animated.svg2')}}></div>

> D2 source to reproduce this is here: [here](https://github.com/terrastruct/d2-docs/blob/master/static/bespoke-d2/animated.d2), rendered with [these parameters](https://github.com/terrastruct/d2-docs/blob/master/ci/render.sh#L12).
> D2 source to reproduce this is here: [here](https://github.com/d2lang/d2-docs/blob/master/static/bespoke-d2/animated.d2), rendered with [these parameters](https://github.com/d2lang/d2-docs/blob/master/ci/render.sh#L12).


Brief factsheet:
Expand Down Expand Up @@ -52,11 +52,11 @@ Or a journey to build up to something.

D2 is not yet 1.0. Of the many things planned in the near term, better ergonomics for
creating these are a priority. The source code for all of these diagrams can be found
[here](https://github.com/terrastruct/d2-docs/tree/master/static/bespoke-d2). Some of
[here](https://github.com/d2lang/d2-docs/tree/master/static/bespoke-d2). Some of
these are currently verbose and repetitive. We've released early to get feedback from the
community, but in-progress things like globs (being able to target objects with `*`) and
classes will make creating these animations much easier than they currently are.

`--animate-interval` is available to use in D2 0.3.0 ([install
here](https://github.com/terrastruct/d2#install)), hope you can check it out and let us
here](https://github.com/d2lang/d2#install)), hope you can check it out and let us
know what you think!
4 changes: 2 additions & 2 deletions blog/ascii.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ d2 in.d2 out.txt

<!-- truncate -->

Here is an example of their rendering from the [D2 Vim extension](https://github.com/terrastruct/d2-vim). The user opens a `.d2` file and opens a preview window, which updates upon every save.
Here is an example of their rendering from the [D2 Vim extension](https://github.com/d2lang/d2-vim). The user opens a `.d2` file and opens a preview window, which updates upon every save.

![D2 Vim preview](/blog/ascii/preview.gif)

Expand All @@ -44,7 +44,7 @@ the flag `--ascii-mode=standard`.
Note that the ASCII renderer should be considered in alpha stage. There will be many
corner cases, areas of improvements, and outright bugs. If you enjoy using it, we'd
appreciate you taking the time to file any issues you run into:
[https://github.com/terrastruct/d2/issues](https://github.com/terrastruct/d2/issues).
[https://github.com/d2lang/d2/issues](https://github.com/d2lang/d2/issues).
:::

The ASCII renderer is a downscale of the layout determined by the ELK layout engine with
Expand Down
2 changes: 1 addition & 1 deletion blog/dark_mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Dark-mode responsive diagrams
description: How diagrams in D2 are responsive to dark mode
slug: dark-mode
tags: [dark mode, show-and-tell]
image: https://raw.githubusercontent.com/terrastruct/d2-docs/master/static/img/blog/dark_mode.png
image: https://raw.githubusercontent.com/d2lang/d2-docs/master/static/img/blog/dark_mode.png
hide_table_of_contents: false
---
import WebPImage from '@site/src/components/WebPImage';
Expand Down
6 changes: 3 additions & 3 deletions blog/powerpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Text to PowerPoint
description: Creating PowerPoint presentations from text with diagrams
slug: powerpoint
tags: [powerpoint, show-and-tell]
image: https://raw.githubusercontent.com/terrastruct/d2-docs/master/static/img/screenshots/wcc_pptx.png
image: https://raw.githubusercontent.com/d2lang/d2-docs/master/static/img/screenshots/wcc_pptx.png
hide_table_of_contents: false
---
import CodeBlock from '@theme/CodeBlock';
Expand All @@ -16,7 +16,7 @@ create full PowerPoint presentations with just text.

It's not D2's primary function, but rather a natural byproduct of a powerful language. D2
built features for grid diagrams and animations, and users built [pixel
art](https://github.com/terrastruct/d2/issues/1218#issuecomment-1512628007). And now, with
art](https://github.com/d2lang/d2/issues/1218#issuecomment-1512628007). And now, with
Markdown and Powerpoint, D2 is the easiest way to programmatically create PowerPoint
presentations.

Expand Down Expand Up @@ -52,7 +52,7 @@ Be sure to go into Present mode to click on objects and navigate around.
- Download: [wcc.pptx](pathname:///img/generated/wcc.pptx)
- Google Slides: [https://docs.google.com/presentation/d/18rRh4izu3k_43On8PXtVYdqRxmoQJd4y/view](https://docs.google.com/presentation/d/18rRh4izu3k_43On8PXtVYdqRxmoQJd4y/view)

The source code for this is a bit longer, and can be found [here](https://github.com/terrastruct/d2/blob/master/docs/examples/wcc/wcc.d2).
The source code for this is a bit longer, and can be found [here](https://github.com/d2lang/d2/blob/master/docs/examples/wcc/wcc.d2).

## Limitations

Expand Down
2 changes: 1 addition & 1 deletion blog/sketch.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Hand-drawn diagram aesthetic
description: How you can make diagrams look hand-drawn in D2
slug: hand-drawn-diagrams
tags: [hand-drawn, show-and-tell]
image: https://raw.githubusercontent.com/terrastruct/d2-docs/master/static/img/blog/sketch.png
image: https://raw.githubusercontent.com/d2lang/d2-docs/master/static/img/blog/sketch.png
hide_table_of_contents: false
---
import CodeBlock from '@theme/CodeBlock';
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ and more. Some of these examples originally were split into multiple files, and
combined for a simplified gallery.

We welcome contributions. These are all open-source; simply submit a PR
[here](https://github.com/terrastruct/d2-docs/tree/master/ci/examples).
[here](https://github.com/d2lang/d2-docs/tree/master/ci/examples).
30 changes: 15 additions & 15 deletions docs/releases/0.7.1.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
#### Features 🚀

- ASCII renders. Output `txt` for d2 to render diagrams as ASCII art [#2572](https://github.com/terrastruct/d2/pull/2572)
- `cross` arrowhead shape is available [#2190](https://github.com/terrastruct/d2/pull/2190)
- `style.underline` support for class fields and methods [#2544](https://github.com/terrastruct/d2/pull/2544)
- markdown, latex, and code can be used as edge labels [#2545](https://github.com/terrastruct/d2/pull/2545)
- border-x label positioning functionality [#2549](https://github.com/terrastruct/d2/pull/2549)
- tooltips with `near` set always show even without hover [#2564](https://github.com/terrastruct/d2/pull/2564)
- CLI supports customizing monospace fonts with `--font-mono`, `--font-mono-bold`, `--font-mono-italic`, and `--font-mono-semibold` flags [#2590](https://github.com/terrastruct/d2/pull/2590)
- ASCII renders. Output `txt` for d2 to render diagrams as ASCII art [#2572](https://github.com/d2lang/d2/pull/2572)
- `cross` arrowhead shape is available [#2190](https://github.com/d2lang/d2/pull/2190)
- `style.underline` support for class fields and methods [#2544](https://github.com/d2lang/d2/pull/2544)
- markdown, latex, and code can be used as edge labels [#2545](https://github.com/d2lang/d2/pull/2545)
- border-x label positioning functionality [#2549](https://github.com/d2lang/d2/pull/2549)
- tooltips with `near` set always show even without hover [#2564](https://github.com/d2lang/d2/pull/2564)
- CLI supports customizing monospace fonts with `--font-mono`, `--font-mono-bold`, `--font-mono-italic`, and `--font-mono-semibold` flags [#2590](https://github.com/d2lang/d2/pull/2590)

#### Improvements 🧹

- labels on scenario/step boards can be set with primary value (like layers) [#2579](https://github.com/terrastruct/d2/pull/2579)
- autoformatter preserves order of boards [#2580](https://github.com/terrastruct/d2/pull/2580)
- rename "Legend" with a title/label of your choosing (especially useful for non-English diagrams) [#2582](https://github.com/terrastruct/d2/pull/2582)
- sketch mode fonts will use custom fonts if provided [#2582](https://github.com/terrastruct/d2/pull/2591)
- labels on scenario/step boards can be set with primary value (like layers) [#2579](https://github.com/d2lang/d2/pull/2579)
- autoformatter preserves order of boards [#2580](https://github.com/d2lang/d2/pull/2580)
- rename "Legend" with a title/label of your choosing (especially useful for non-English diagrams) [#2582](https://github.com/d2lang/d2/pull/2582)
- sketch mode fonts will use custom fonts if provided [#2582](https://github.com/d2lang/d2/pull/2591)

#### Bugfixes ⛑️

- actors in sequence diagrams with labels and icons together no longer overlap, position keywords now work too [#2548](https://github.com/terrastruct/d2/pull/2548)
- fix double glob behavior in scenarios (wasn't propagating correctly) [#2557](https://github.com/terrastruct/d2/pull/2557)
- fix diagram bounding box not accounting for legend in some cases [#2584](https://github.com/terrastruct/d2/pull/2584)
- actors in sequence diagrams with labels and icons together no longer overlap, position keywords now work too [#2548](https://github.com/d2lang/d2/pull/2548)
- fix double glob behavior in scenarios (wasn't propagating correctly) [#2557](https://github.com/d2lang/d2/pull/2557)
- fix diagram bounding box not accounting for legend in some cases [#2584](https://github.com/d2lang/d2/pull/2584)

#### Breaking Changes

- If you are using D2 as a library/API, passing in a FontFamily with `sketch` renders will now use the font, instead of previously ignoring it.

---

For the latest d2.js changes, see separate [changelog](https://github.com/terrastruct/d2/blob/master/d2js/js/CHANGELOG.md).
For the latest d2.js changes, see separate [changelog](https://github.com/d2lang/d2/blob/master/d2js/js/CHANGELOG.md).
2 changes: 1 addition & 1 deletion docs/releases/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Version: [0.7.1](/releases/0.7.1) (released August 19, 2025)

Downloads: [Assets](https://github.com/terrastruct/d2/releases/tag/v0.7.1)
Downloads: [Assets](https://github.com/d2lang/d2/releases/tag/v0.7.1)

:::

Expand Down
2 changes: 1 addition & 1 deletion docs/tour/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pagination_next: tour/man
D2 has an API built on top of its AST for **programmatically creating diagrams in Go**.
This package is `d2/d2oracle`.

This API is exercised heavily by Terrastruct to implement [bidirectional edits](https://youtu.be/EhxVVkxv2Ns?t=150). We have [comprehensive test coverage](https://github.com/terrastruct/d2/blob/master/d2oracle/edit_test.go) of these functions. If there's any confusion from the docs, there's almost certainly a test that answers your question. (We're also happy to help, just file a GitHub issue!)
This API is exercised heavily by Terrastruct to implement [bidirectional edits](https://youtu.be/EhxVVkxv2Ns?t=150). We have [comprehensive test coverage](https://github.com/d2lang/d2/blob/master/d2oracle/edit_test.go) of these functions. If there's any confusion from the docs, there's almost certainly a test that answers your question. (We're also happy to help, just file a GitHub issue!)

For a blog post detailing an example usage (building a SQL table diagram), see [https://terrastruct.com/blog/post/generate-diagrams-programmatically/](https://terrastruct.com/blog/post/generate-diagrams-programmatically/).

Expand Down
4 changes: 2 additions & 2 deletions docs/tour/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
href="https://discord.gg/NF6X8K4eDq">https://discord.gg/NF6X8K4eDq</a>. If you have a
question or need help, you'll find responses quickest through this channel.
- Have a proposal, running into a bug, or anything else you want to discuss with the team
and community? D2 uses [GitHub Issues](https://github.com/terrastruct/d2) to track all
TODOs, and [GitHub Discussions](https://github.com/terrastruct/d2/discussions) for
and community? D2 uses [GitHub Issues](https://github.com/d2lang/d2) to track all
TODOs, and [GitHub Discussions](https://github.com/d2lang/d2/discussions) for
feature requests and ideas.
- If you have a private enquiry, please email us: hi@d2lang.com.
4 changes: 2 additions & 2 deletions docs/tour/editor-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ We have first class language support for both Vim and VS Code.
Automatic indentation and syntax highlighting are fully supported and make working with
the D2 language far more pleasant.

- https://github.com/terrastruct/d2-vim
- https://github.com/terrastruct/d2-vscode
- https://github.com/d2lang/d2-vim
- https://github.com/d2lang/d2-vscode

The syntax highlighting will even catch basic errors for you if your color theme
highlights illegal syntax.
2 changes: 1 addition & 1 deletion docs/tour/exports.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ npm install -g @playwright
npx playwright install --with-deps chromium
```

See [#744](https://github.com/terrastruct/d2/issues/744#issuecomment-1446641870) for more.
See [#744](https://github.com/d2lang/d2/issues/744#issuecomment-1446641870) for more.
:::

## PDF
Expand Down
5 changes: 2 additions & 3 deletions docs/tour/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ instructions and examples so you can include it in your browser projects.
...e.g., an item in the middle of a venn diagram.

Not currently and not in the near future. See
[discussion](https://github.com/terrastruct/d2/discussions/328) for more.
[discussion](https://github.com/d2lang/d2/discussions/328) for more.

### Can I specify ports?

Not currently, but in the near future. See
[discussion](https://github.com/terrastruct/d2/discussions/605) for more.
[discussion](https://github.com/d2lang/d2/discussions/605) for more.

## Exports

Expand Down Expand Up @@ -107,4 +107,3 @@ tldr; when it's treated as an image, the interactivity is lost.
</tr>
</tbody>
</table>

8 changes: 4 additions & 4 deletions docs/tour/future.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import WebPImage from '@site/src/components/WebPImage';

:::info TLDR
[https://github.com/terrastruct/d2/issues?q=is%3Aopen+is%3Aissue+label%3Afeature](https://github.com/terrastruct/d2/issues?q=is%3Aopen+is%3Aissue+label%3Afeature)
[https://github.com/d2lang/d2/issues?q=is%3Aopen+is%3Aissue+label%3Afeature](https://github.com/d2lang/d2/issues?q=is%3Aopen+is%3Aissue+label%3Afeature)
:::

D2's long-term goal is to significantly reduce the amount of time and effort it takes to
Expand Down Expand Up @@ -152,7 +152,7 @@ unforeseen ones for the infinite workflows out there.
D2's plugin system further makes the language extensible. These allow you to add "hooks"
to stages of D2 compilation. For example, while not core to D2, a hypothetical set of
plugins can add a styled border, add your signature/credits, make everything [look
hand-drawn](https://github.com/terrastruct/d2/pull/91), then increase contrast for
hand-drawn](https://github.com/d2lang/d2/pull/91), then increase contrast for
accessibility.

### How success is measured
Expand Down Expand Up @@ -185,7 +185,7 @@ unplanned usage.
## Your feedback

If you have any suggestions or feedback, we'd love to hear from you! Please open an issue
on [Github](https://github.com/terrastruct/d2).
on [Github](https://github.com/d2lang/d2).

## Notes

Expand All @@ -203,7 +203,7 @@ widely released and their live editor still won't allow it.
visit [https://terrastruct.com/tala](https://terrastruct.com/tala).

[4] If you still miss the hand-drawn aesthetic, D2 has just the thing:
https://github.com/terrastruct/d2/pull/492
https://github.com/d2lang/d2/pull/492

[5] Actually, gopls single-handedly brings my machine back to 2005 speeds with how much
CPU it consumes. Not the fault of vim-go though!
10 changes: 5 additions & 5 deletions docs/tour/grid-diagrams.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ It would do the opposite.
:::info
These animations are also pure D2, so you can animate grid diagrams being built-up. Use
the `animate-interval` flag with this
[code](https://github.com/terrastruct/d2-docs/blob/f5c762223ce192338d9d7865df3ca8533d683cdc/static/bespoke-d2/grid-row-dominant.d2#L1).
[code](https://github.com/d2lang/d2-docs/blob/f5c762223ce192338d9d7865df3ca8533d683cdc/static/bespoke-d2/grid-row-dominant.d2#L1).
More on this later, in the [composition](/tour/composition/) section.
:::

Expand All @@ -131,7 +131,7 @@ Setting `grid-gap` is equivalent to setting both `vertical-gap` and `horizontal-

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/japan.svg2')}}></div>

> [D2 source](https://github.com/terrastruct/d2/blob/master/docs/examples/japan-grid/japan.d2)
> [D2 source](https://github.com/d2lang/d2/blob/master/docs/examples/japan-grid/japan.d2)

#### Or a table of data

Expand Down Expand Up @@ -160,7 +160,7 @@ Connections for grids themselves work normally as you'd expect.

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/grid-connected.svg2')}}></div>

> Source code [here](https://github.com/terrastruct/d2-docs/blob/eda2d8739ce21c656e7608be48cb9067df36eb53/static/d2/grid-connected.d2).
> Source code [here](https://github.com/d2lang/d2-docs/blob/eda2d8739ce21c656e7608be48cb9067df36eb53/static/d2/grid-connected.d2).

### Connections between grid cells

Expand All @@ -171,11 +171,11 @@ i.e., no path-finding.

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/grid-connections.svg2')}}></div>

> Source code [here](https://github.com/terrastruct/d2/blob/master/e2etests/testdata/files/simple_grid_edges.d2).
> Source code [here](https://github.com/d2lang/d2/blob/master/e2etests/testdata/files/simple_grid_edges.d2).

<div className="embedSVG" dangerouslySetInnerHTML={{__html: require('@site/static/img/generated/grid-nested-connections.svg2')}}></div>

> Source code [here](https://github.com/terrastruct/d2/blob/master/docs/examples/vector-grid/vector-grid.d2).
> Source code [here](https://github.com/d2lang/d2/blob/master/docs/examples/vector-grid/vector-grid.d2).

## Nesting

Expand Down
14 changes: 7 additions & 7 deletions docs/tour/help.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contributing

Contributions are welcome! Please see the full doc on contributing on D2's Github:
[https://github.com/terrastruct/d2/blob/master/docs/CONTRIBUTING.md](https://github.com/terrastruct/d2/blob/master/docs/CONTRIBUTING.md).
[https://github.com/d2lang/d2/blob/master/docs/CONTRIBUTING.md](https://github.com/d2lang/d2/blob/master/docs/CONTRIBUTING.md).

## Help wanted

Expand All @@ -12,11 +12,11 @@ Below is a list of features that could use your help. If you're interested in ta
initiative, feel free to just start, or you can comment on a GitHub issue, discuss in
Discord, or email us (alex at terrastruct).

- [ownCloud Infinite Scale Extension](https://github.com/terrastruct/d2/issues/1422)
- [IntelliJ plugin](https://github.com/terrastruct/d2/issues/747)
- [Chocolatey package](https://github.com/terrastruct/d2/issues/154)
- [Docusaurus plugin](https://github.com/terrastruct/d2/issues/1448)
- [Visual Studio Extension](https://github.com/terrastruct/d2/discussions/237)
- [PrismJS highlighter](https://github.com/terrastruct/d2-docs/issues/185)
- [ownCloud Infinite Scale Extension](https://github.com/d2lang/d2/issues/1422)
- [IntelliJ plugin](https://github.com/d2lang/d2/issues/747)
- [Chocolatey package](https://github.com/d2lang/d2/issues/154)
- [Docusaurus plugin](https://github.com/d2lang/d2/issues/1448)
- [Visual Studio Extension](https://github.com/d2lang/d2/discussions/237)
- [PrismJS highlighter](https://github.com/d2lang/d2-docs/issues/185)

Want to add something to this wishlist? Just make an Issue on D2's GitHub!
Loading
Loading