Releases: terrastruct/d2
v0.5.0
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
, andhorizontal-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
ormultiple
#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 omittingshape: 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
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
andstyle
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 beclass
orsql_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
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!
- Download: wcc.pptx
- Google Slides: https://docs.google.com/presentation/d/18rRh4izu3k_43On8PXtVYdqRxmoQJd4y/view
- Source code: https://github.com/terrastruct/d2/blob/master/docs/examples/wcc/wcc.d2
GIF example
This is the same diagram as one we shared when we announced animated SVGs, but in GIF form.
Features 🚀
- Export diagrams to
.pptx
(PowerPoint) #1139 - Export diagrams to
.gif
#1200 - Customize gap size in grid diagrams with
grid-gap
,vertical-gap
, orhorizontal-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 ⛑️
v0.4.0
Major updates in 0.4.0:
classes
andclass
are finally here. No more repeating styles!- Introducing Grid diagrams. A very popular form of diagramming software architecture.
To showcase both of these, here's a demo with a link to the source code below:
Bunch of other features, improvements, and bug fixes too. Make sure to check out the updated docs for how to use these new features!
Features 🚀
- Classes are implemented. See docs. #772
- Grid diagrams are implemented. See docs. #1122
- Container with constant key near attribute now can have descendant objects and connections (thank you @donglixiaoche) #1071
- Multi-board SVG outputs with internal links go to their output paths #1116
Improvements 🧹
- Labels on parallel
dagre
connections include a gap between them #1134 - Sequence diagram lifelines inherit the actor's
stroke
andstroke-dash
#1140 - Add
text-transform
styling option (thank you @alexstoick for these 2) #1118
Bugfixes ⛑️
- Fix inheritence in scenarios/steps #1090
- Fix a bug in 32bit builds #1115
- Fix a bug in ID parsing #322
- Fix a bug in watch mode parsing SVG #1119
- Namespace transitions so that multiple animated D2 diagrams can exist on the same page #1123
- Fix a bug in vertical alignment of appendix lines #1104
- Fix precision difference for sketch mode running on different architectures #921
- Fix an issue where markdown fonts weren't being applied correctly #1132
Breaking changes
class
andclasses
are now reserved keywords.text-transform
is now a reserved keyword.
v0.3.0
D2 0.3 is here!
Major updates:
- SVG sizes are ~5% of what they were in D2 0.2.
- The disproportionately largest contributor to this size was the font. Instead of encoding the entire font, D2 now only bundles only the used part of it (e.g. if you don't use the letter "b", the font encoding for "b" won't be included).
- The first practical applications of multi-board compositions are here: animations. Composition is among D2's most powerful features, and these first applications are just the tip of the iceberg. Stay tuned for more in upcoming 0.3.x releases. See docs.
- Customizable fonts. You can pass in whatever you want to use through the command line.
Other
- New "Origami" theme
Features 🚀
- Flags to set a custom font are supported. See docs. #1108
--animate-interval
can be passed as a flag to animate multi-board diagrams. See docs. #1088- New
fill-pattern
:paper
#1070 - Fonts are subsetted to only include what's necessary #1089
- New theme: Origami #1110
Improvements 🧹
- Prevent
tooltip
being set to a URL whenlink
is already set (for security) #1091 - Scale arrowhead sizes appropriately to
stroke-width
. #1101
Bugfixes ⛑️
v0.2.6
Features 🚀
--center
flag centers the SVG in the containing viewbox. #1056- Strikethrough in Markdown with
~~
. #1059
Improvements 🧹
elk
layout containers no longer overlap the label with children. #1055--browser
flag on CLI controlsBROWSER
environment variable for not opening browser in watch mode. #1052- Message emitted by CLI when a particular stage is taking a long time. #1058
<title>
attribute of HTML in watch mode is the base file name, instead of the whole path. #1054
Bugfixes ⛑️
v0.2.5
Customizations and layouts take a big leap forward with this release! Put together, these improvements make beautiful diagrams like these possible:
Features 🚀
- New class of special themes, starting with
Terminal
, andTerminal Grayscale
. See docs. #1040, #1041 style.font: mono
to use a monospaced font for the text/label. See docs. #1010border-radius
is supported for bothclass
andsql_table
shapes. Thanks to second-time contributor @donglixiaoche ! #982- Implements
style.fill-pattern
. See docs. #1024, #1041
Improvements 🧹
dagre
layouts that have a connection where one endpoint is a container is much improved. #1011elk
layouts have less bends in the routes. #1033elk
layouts center nodes better. #1028elk
layouts have nicer margins between node boundaries and edges. #1028elk
layouts container contents are centered within. #1038elk
layouts container dimensions fit label. #1038sketch
draws connections with less roughness, which especially improves look of corner bends in ELK. #1014- CSS in SVGs are diagram-specific, which means you can embed multiple D2 diagrams on a web page without fear of style conflicts. #1016
Bugfixes ⛑️
- Fixes
d2
erroring on malformed user paths (fdopendir
error). util-go#10 - Arrowhead labels being set without maps wasn't being picked up. #1015
- Fixes a
dagre
layout error with connections to a container shape with a blockstring label. #1032
v0.2.4
ELK layout has been much improved by increasing node dimensions to make room for nice even padding around ports:
Do you use ELK more than dagre? We're considering switching d2's default layout engine to ELK, so please chime in to this poll if you have an opinion! #990
Improvements 🧹
- ELK nodes with > 1 connection grow to ensure padding around ports #981
- Using a style keyword incorrectly in connections returns clear error message #989
- Unsemantic Markdown returns clear error message #994
Bugfixes ⛑️
v0.2.3
Diagrams that link between objects and the source they represent are much more integrated into your overall documentation than standalone diagrams. This release brings the linking feature to PDFs! Try clicking on "GitHub" object in the following PDF:
Code blocks now adapt to dark mode:
Welcome new contributor @donglixiaoche , who helps D2 support border-radius on connections!
Features 🚀
- PDF exports support linking #891, #966
border-radius
is supported on connections (ELK and TALA only, since dagre uses curves). #913
Improvements 🧹
- Code blocks adapt to dark mode #971
- SVGs are fit to top left by default to avoid issues with zooming. #954
- Person shapes have labels below them and don't need to expand as much. #960
Bugfixes ⛑️
v0.2.2
style
keywords now apply at the root level, letting you style the diagram background and frame like so:
(also showcases a little 3d hexagon, newly supported thanks to our newest contributor @JettChenT !)
PDF is also now supported as an export format:
Features 🚀
- PDF exports. See docs. #120
- Diagram background and frame can be added and styled. See docs. #910
3d
works onhexagon
shapes. #869- The arm64 docker container supports rendering diagrams to PNGs. #917
Improvements 🧹
near
key set to sequence diagram children get an appropriate error message. #899class
andsql_table
shape respectfont-color
styling as header font color. #899- SVG fits to screen by default in both watch mode and as a standalone SVG (this time with just CSS, no JS). #725
- Only chromium is installed when rendering png diagrams instead of also installing webkit and firefox. #835
- Multiboard output is now self-contained and less confusing. See #923