Skip to content

Releases: terrastruct/d2

v0.6.5

18 Apr 05:18
8101580
Compare
Choose a tag to compare

D2 0.6.5 has a hotfix for 0.6.4 breaking plugin compatibility. Also includes 2 compiler fixes regarding substitutions/vars.

Bugfixes ⛑️

  • Fix executable plugins that implement standalone router #1910
  • Fix compiler error with multiple nested spread substitutions #1913
  • Fix substitutions from imports into different scopes #1914

v0.6.4

11 Apr 06:03
e6e5fea
Compare
Choose a tag to compare

Features 🚀

  • style.underline works on connections #1836
  • none is added as an accepted value for fill-pattern. Previously there was no way to cancel the fill-pattern on select objects set by a theme that applies it (Origami) #1882

Improvements 🧹

  • Dimensions can be set less than label dimensions #1901
  • Boards no longer inherit label fields from parents #1838
  • Prevents near targeting a child of a special object like grid cells, which wasn't doing anything #1851

Bugfixes ⛑️

  • Theme flags on CLI apply to PDFs #1894
  • Fixes styles in connections not overriding styles set by globs #1857
  • Fixes null being set on a nested shape not working in certain cases when connections also pointed to that shape #1830
  • Fixes edge case of bad import syntax crashing using d2 as a library #1829
  • Fixes style.fill not applying to markdown #1872
  • Fixes compiler erroring on certain styles when the shape's shape value is not all lowercase (e.g. Circle) #1887

v0.6.3

16 Dec 23:27
2419876
Compare
Choose a tag to compare

D2 0.6.3 allows you to make your own and customize existing D2 themes. Here's an example with some random color codes.

Screen Shot 2023-12-16 at 3 13 04 PM

See docs

Playground link

Features 🚀

  • Themes can be customized via d2-config vars. #1777

Improvements 🧹

  • Icons can be added for special objects (sql_table, class, code, markdown, latex). #1774

Bugfixes ⛑️

  • Fix importing files that override an existing value with an array. #1762
  • Fixes missing unfilled triangle arrowheads when sketch flag is on. #1763
  • Fixes a bug where the render target could be incorrect if the target path contains "index". #1764
  • Fixes ELK layout with outside labels/icons. #1776
  • Fixes a bug where an edge could become disconnected with dagre layout and direction right. #1778

v0.6.2

07 Dec 00:19
e377e79
Compare
Choose a tag to compare

D2 0.6.2 makes grid diagrams significantly more powerful. Namely, connections can now be made from grid elements to other grid elements. This enables diagrams like the following.

vector-grid

Source code

Playground link

Credit: this diagram is based off of a manually-drawn one from a blog post

In addition, another significant feature is that using the ELK layout engine will now route SQL diagrams to their exact columns.

Screen Shot 2023-12-06 at 3 26 39 PM

Playground link

Note that all previous playground links will be broken given the encoding change. The encoding before 0.6.2 used the keyword set as compression dictionary, but it no longer does, so this will be the last time playground links break.

Features 🚀

  • ELK routes sql_table edges to the exact columns (ty @landmaj) #1681
  • Unfilled triangle arrowhead is available. #1711
  • Grid containers customize label positions. #1715
  • A single board from a multi-board diagram can be rendered with --target flag. #1725

Improvements 🧹

  • Grid cells can contain nested edges #1629
  • Edges can go across constant nears, sequence diagrams, and grids, including nested ones. #1631
  • All vars defined in a scope are accessible everywhere in that scope, i.e., an object can use a var defined after itself. #1695
  • Encoding API switches to standard zlib encoding so that decoding doesn't depend on source. #1709
  • currentcolor is accepted as a color option to inherit parent colors. (ty @hboomsma) #1700
  • Grid containers can be sized with width/height even when using a layout plugin without that feature. #1731
  • Watch mode watches for changes in both the input file and imported files #1720

Bugfixes ⛑️

  • Fixes a bug calculating grid height with only grid-rows and different horizontal-gap and vertical-gap values. #1646
  • Grid layout accounts for each cell's outside labels and icons #1624
  • Grid layout accounts for labels wider or taller than the shape and fixes default label positions for image grid cells. #1670
  • Fixes a panic with a spread substitution in a glob map #1643
  • Fixes use of null in sql_table constraints (ty @landmaj) #1660
  • Fixes ELK growing shapes with width/height set #1679
  • Adds a compiler error when accidentally using an arrowhead on a shape #1686
  • Correctly reports errors from invalid values set by globs. #1691
  • Fixes panic when spread substitution referenced a nonexistant var. #1695
  • Fixes incorrect appendix icon numbering. #1704
  • Fixes crash when using --watch and navigating to an invalid board path #1693
  • Fixes edge case where nested edge globs were creating excess shapes #1713
  • Fixes a panic with a connection to a grid cell that is a container in TALA #1729
  • Fixes incorrect grid cell positioning when the grid has a shape set and fixes content sometimes escaping circle shapes. #1734
  • Fixes content sometimes escaping cloud shapes. #1736
  • Fixes panic using a glob filter (e.g. &a) outside globs. #1748
  • Fixes glob keys with import values (e.g. user*: @lib/user). #1755

v0.6.1

26 Sep 18:45
7c1d806
Compare
Choose a tag to compare

The globs feature underwent a major rewrite and is now almost finalized.

Before

Previously, globs would evaluate once on all the shapes and connections declared above it. So if you wanted to set everything red, you had to add the line at the bottom.

x
y

*.style.fill: red

Now

*.style.fill: red

x
y

We still have one more release in 0.6 series to add filters to globs, so stay tuned.

You might also be interested to know that grid cells can now have connections between them! Source code for this diagram here.

267854495-bc0a5456-3618-4d46-84db-f211ffb5246a

Features 🚀

  • UTF-16 files are automatically detected and supported #1525
  • Grid diagrams can now have simple connections between top-level cells #1586

Improvements 🧹

  • Globs are lazily-evaluated #1552
  • Latex blocks includes Mathjax's ASM extension #1544
  • font-color works on Markdown #1546
  • font-color works on arrowheads #1582
  • CLI failure message includes input path #1617

Bugfixes ⛑️

  • d2 fmt formats all files passed as arguments rather than just the first non-formatted (thank you @maxbrunet) #1523
  • Fixes Markdown cropping last element in mixed-element blocks (e.g. em and strong) #1543
  • Adds compiler error for non-blockstring empty labels #1590
  • Prevents multiple constant nears overlapping in some cases #1591
  • Fixes crash from empty nested grid #1594
  • d2fmt with variable substitution mid-string is formatted correctly #1611
  • Fixes certain shape IDs not working with dagre #1610
  • Fixes font-size adjustments missing from rendered code shape #1614

v0.6.0

31 Jul 05:41
c2dea55
Compare
Choose a tag to compare

D2 v0.6 introduces variable substitutions and globs. These two were the last of the features planned in the initial designs for D2, and v1 is now very close!

The power of variables and globs in a programming language need no introduction, so here's two minimal examples to get started:

Variables:

vars: {
  color: aquamarine
}

x.style.fill: ${color}

Globs:

x
y
z

*.style.fill: aquamarine

Both are live on D2 Playground so give it a try! Looking forward to your issues and iterating

Layout capability also takes a subtle but important step forward: you can now customize the position of labels and icons.

Features 🚀

  • Variables and substitutions are implemented. See docs. #1473
  • Configure timeout value with D2_TIMEOUT env var #1392
  • Scale renders and disable fit to screen with --scale flag #1413
  • null keyword can be used to un-declare. See docs #1446
  • Develop multi-board diagrams in watch mode (links to layers/scenarios/steps work in --watch) #1503
  • Glob patterns have been implemented. See docs. #1479

Improvements 🧹

  • Display version on CLI help invocation #1400
  • Improved readability of connection labels when they overlap another connection #447
  • Error message when shape is given a composite #1415
  • Improved rendering and text measurement for code shapes #1425
  • The autoformatter moves board declarations to the bottom of its scope #1424
  • All font styles in sketch mode use a consistent font-family #1463
  • Tooltip and link icons are positioned on shape border #1466
  • Tooltip and link icons are always rendered over shapes #1467
  • Boards with no objects are considered folders #1504
  • DEBUG environment variable ignored if set incorrectly #1505

Bugfixes ⛑️

  • Fixes edge case in compiler using dots in quotes #1401
  • Fixes grid label font size for TALA #1412
  • Fixes person shape label positioning with multiple or 3d #1478

v0.5.1

10 Jun 03:35
320f809
Compare
Choose a tag to compare

This is a hotfix to 0.5.0, imports weren't working on Windows.

Improvements 🧹

  • Improves compiler's tooltip URL check. #1390

v0.5.0

09 Jun 04:28
4ddb67a
Compare
Choose a tag to compare

There are three important features that were in the initial design of D2 that have not been done and hold it back from 1.0: globs, imports, and vars. This release brings imports.

Imports open up a world of possibilities and works beautifully to modularize diagrams. See the new docs to try it out today.

As usual, many improvements and bug fixes accompany this release. D2 0.5 produces more legible diagrams by masking obstructions (e.g. arrow going through a label), has better error messages to guide you, is faster at certain tasks, and addresses many issues brought by community bug reports.

Features 🚀

  • D2 files have the ability to import from other D2 files. See docs. #1371
  • sql_table alternatively takes an array of constraints instead of being limited to a single one. Thanks @satoqz ! #1245

Improvements 🧹

  • Use shape-specific sizing for grid containers #1294
  • Grid diagrams support nested shapes or grid diagrams #1309
  • grid-gap, vertical-gap, and horizontal-gap apply to padding on grid diagrams #1309
  • Watch mode browser uses an error favicon to easily indicate compiler errors. Thanks @sinyo-matu ! #1240
  • Grid layout performance improved when there are many similarly sized shapes #1315
  • Connections and labels are adjusted for shapes with 3d or multiple #1340
  • Constraints in sql_table render even if they have no matching abbreviation #1372
  • Constraints in sql_table sheds their excessive letter-spacing and is padded from the end consistently #1372
  • Duplicate image URLs in icons are only fetched once #1373
  • In watch mode, images are cached by default across compiles. Can be disabled with flag --img-cache=0. #1373
  • Common invalid array separator , usage in class arrays returns a helpful error message #1376
  • Invalid constraint usage is met with an error message, preventing a common mistake of omitting shape: sql_table #1379
  • Connections no longer obscure outside labels #1381
  • Container connections in dagre are more balanced #1384
  • Connections that go through shape labels are now masked translucently #1383

Bugfixes ⛑️

  • Shadow is no longer cut off when --pad is 0. Thank you @LeonardsonCC ! #1326
  • Fixes grid layout overwriting label placements for nested objects #1345
  • Fixes fonts not rendering correctly on certain platforms. Thanks @mikeday for identifying the solution. #1356
  • Fixes folders not rendering in animations (--animate-interval) #1357
  • Fixes panic using reserved keywords as containers #1358
  • When multiple classes are change different attributes of arrowheads, they are
    all applied instead of only the last one #1362
  • Prevent empty block strings #1364
  • Fixes dagre mis-aligning a nested shape's connection #1370
  • Fixes a bug in grids sometimes putting a shape on the next row/column #1380

Breaking changes

  • @xyz is now reserved as a pattern for imports. If you previously had a key that started like that, it must either be renamed or quoted like "@xyz".
  • Likewise with ...@xyz (spread operator import)

v0.4.2

02 May 18:34
65a9e43
Compare
Choose a tag to compare

This release improves on the features introduced in 0.4, with class keyword now accepting multiple class values with an array, and grid diagrams becoming faster and more robust.

Multiple classes example:

classes: {
  base: {
    style: {
      stroke-dash: 2
      border-radius: 5
      font: mono
      text-transform: uppercase
    }
  }
  error: {
    style.fill: "#e07d7d"
    style.stroke: "#a60c0c"
    style.font-color: white
  }
  success: {
    style.fill: "#86f499"
    style.stroke: "#017f07"
    style.font-color: black
  }
}

server-1.class: [base; error]
server-2.class: [base; success]

Features 🚀

  • class field now accepts arrays. See docs. #1256
  • Pill shape is implemented with rectangles of large border radius. See docs. Thanks @Poivey ! #1006

Improvements 🧹

  • ELK self loops get distributed around the object instead of stacking #1232
  • ELK preserves order of objects in cycles #1235
  • Improper usages of class and style get error messages #1254
  • Improves scaling of object widths/heights in grid diagrams #1263
  • Enhance Markdown parsing error message by appending link to docs #1269

Bugfixes ⛑️

  • Fixes an issue with markdown labels that are empty when rendered #1223
  • ELK self loops always have enough space for long labels #1232
  • Fixes panic when setting shape to be class or sql_table within a class #1251
  • Fixes rare panic exporting to gifs #1257
  • Fixes bad performance in large grid diagrams #1263
  • Fixes bug in ELK when container has ID "root" #1268
  • Fixes edge case panic with invalid CLI arguments #1271

v0.4.1

18 Apr 02:05
f387498
Compare
Choose a tag to compare

Multi-board D2 compositions now get 2 more useful formats to export to: PowerPoint and GIFs.

Powerpoint example

Make sure you click present, and click around the links and navigations!

GIF example

This is the same diagram as one we shared when we announced animated SVGs, but in GIF form.

animated

Features 🚀

  • Export diagrams to .pptx (PowerPoint) #1139
  • Export diagrams to .gif #1200
  • Customize gap size in grid diagrams with grid-gap, vertical-gap, or horizontal-gap (see docs) #1178
  • New dark theme "Dark Terrastruct Flagship" with the theme ID of 201 #1150

Improvements 🧹

  • font-size works with Markdown text #1191
  • SVG outputs for internal links use relative paths instead of absolute #1197
  • Improves arrowhead label positioning #1207

Bugfixes ⛑️

  • Fixes grid layouts not applying on objects with a constant near #1173
  • Fixes Markdown header rendering in Firefox and Safari #1177
  • Fixes a grid layout panic when there are fewer objects than rows/columns #1189
  • Fixes an issue where PNG exports that were too large were crashing #1093