Skip to content

Releases: terrastruct/d2

v0.4.0

09 Apr 02:44
a4f9048
Compare
Choose a tag to compare

Major updates in 0.4.0:

  • classes and class 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:

Screen Shot 2023-04-08 at 7 20 04 PM

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 and stroke-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 and classes are now reserved keywords.
  • text-transform is now a reserved keyword.

v0.3.0

30 Mar 05:13
584a543
Compare
Choose a tag to compare

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.
    animated
  • Customizable fonts. You can pass in whatever you want to use through the command line.

Screen Shot 2023-03-29 at 8 27 45 PM

Other

  • New "Origami" theme

Screen Shot 2023-03-29 at 7 59 31 PM

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 when link is already set (for security) #1091
  • Scale arrowhead sizes appropriately to stroke-width. #1101

Bugfixes ⛑️

  • Prevents an object's near from targeting another object with near set to a constant #1100
  • Fixes inaccurate bold edge label padding #1108
  • Prevents Latex blocks from being uppercased in special themes #1111

v0.2.6

18 Mar 22:52
022cf12
Compare
Choose a tag to compare

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 controls BROWSER 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 ⛑️

  • Code blocks are not affected by uppercasing from special themes like Terminal. #1053
  • Fixes fill-pattern replacement in the API. #1051
  • Fixes multiple <br/> elements in a row being mismeasured in Markdown blocks. #1060

v0.2.5

16 Mar 22:49
e996325
Compare
Choose a tag to compare

Customizations and layouts take a big leap forward with this release! Put together, these improvements make beautiful diagrams like these possible:

mono

Playground link

Features 🚀

  • New class of special themes, starting with Terminal, and Terminal Grayscale. See docs. #1040, #1041
  • style.font: mono to use a monospaced font for the text/label. See docs. #1010
  • border-radius is supported for both class and sql_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. #1011
  • elk layouts have less bends in the routes. #1033
  • elk layouts center nodes better. #1028
  • elk layouts have nicer margins between node boundaries and edges. #1028
  • elk layouts container contents are centered within. #1038
  • elk layouts container dimensions fit label. #1038
  • sketch 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

07 Mar 19:18
7e398e1
Compare
Choose a tag to compare

ELK layout has been much improved by increasing node dimensions to make room for nice even padding around ports:
elk

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 ⛑️

  • Accept absolute paths again on the CLI (regression from previous release). #979
  • Fixes some rare undefined behavior using capitalized reserved keywords #978
  • Fixes an error rendering when links contained & characters #988

v0.2.3

04 Mar 20:00
fb20527
Compare
Choose a tag to compare

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:

linked.pdf

Code blocks now adapt to dark mode:

Screen Shot 2023-03-04 at 11 33 46 AM

Welcome new contributor @donglixiaoche , who helps D2 support border-radius on connections!
Screen Shot 2023-03-04 at 11 33 46 AM

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 ⛑️

  • Fixes a regression where PNG backgrounds could be cut off in the appendix. #941
  • Fixes zooming not working in watch mode. #944
  • Fixes insufficient vertical padding in dagre with direction: right/left. #973

v0.2.2

28 Feb 05:36
ab4e454
Compare
Choose a tag to compare

style keywords now apply at the root level, letting you style the diagram background and frame like so:

chilly
playground link

(also showcases a little 3d hexagon, newly supported thanks to our newest contributor @JettChenT !)

PDF is also now supported as an export format:

demo.pdf

Features 🚀

  • PDF exports. See docs. #120
  • Diagram background and frame can be added and styled. See docs. #910
  • 3d works on hexagon 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. #899
  • class and sql_table shape respect font-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

Bugfixes ⛑️

  • Error reported when no actors are declared in sequence diagram. #886
  • Fixes img bundling on image shapes. #889
  • class shape as sequence diagram actors had wrong colors. #899
  • Fixes regression in last release where some hex codes were not working. #922

v0.2.1

24 Feb 03:57
423893c
Compare
Choose a tag to compare

Dark mode support has landed! Thanks to @vfosnar for such a substaintial first-time contribution to D2. Only one dark theme option accompanies the support, so if you have a dark theme you like, please feel free to submit into D2!

dark_docs.mp4

D2 is now usable in non-Latin languages (and emojis!), as the font-measuring accounts for multi-byte characters. Thanks @bo-ku-ra for keeping this top of mind.

D2 0.2.0 vs 0.2.1:

japanese

Sketch mode's subtle hand-drawn texture adapts to background colors. Previously the streaks were too subtle on lighter backgrounds and too prominent on darker ones.

sketch

This release also fixes a number of non-trivial layout bugs made in v0.2.0, and has better error messages.

Features 🚀

  • Dark theme support! See docs. #613
  • Many non-Latin languages (e.g. Chinese, Japanese, Korean) are usable now that multi-byte characters are measured correctly. #817
  • Dimensions can be set on containers (layout engine dependent). #845

Improvements 🧹

  • Sketch mode's subtle hand-drawn texture adapts to background colors. #613
  • Improves label legibility for dagre containers by stopping container edges early if they would run into the label. #880
  • Cleaner watch mode logs without timestamps. #830
  • Remove duplicate success logs in watch mode. #830
  • CLI reports when a feature is incompatible with layout engine, instead of silently ignoring. #845
  • near key set to direct parent or ancestor throws an appropriate error message. #851
  • Dimensions and positions are able to be set from API. #853

Bugfixes ⛑️

  • Fixes edge case where layouts with dagre show a connection from the bottom side of shapes being slightly disconnected from the shape. #820
  • Bounding boxes weren't accounting for icons placed on the boundaries. #879
  • Sequence diagrams using special characters in object IDs could cause rendering bugs. #856
  • Fixes rare compiler bug when using underscores in edges to create objects across containers. #824
  • Fixes rare possibility of rendered connections being hidden or cut off. #828
  • Creating nested children within sql_table and class shapes are now prevented (caused confusion when accidentally done). #834
  • Fixes graph deserialization bug. #837
  • steps with non-map fields could cause panics. #783

v0.2.0

13 Feb 20:10
1639f56
Compare
Choose a tag to compare

Here's what a D2 diagram looks like in 0.1 (left) vs 0.2 (right):

before-after

Much more legible, especially in larger diagrams! This upgrade trims a lot of the excess whitespace present before and makes diagrams more compact. We've also combed through each shape to improve their label and icon positions, paddings, and aspect ratios at different sizes. Example of icons and labels avoiding collisions:

aws icons

We've also put up a hosted icon site for you to conveniently find common software architecture icons to include in your D2 diagrams. https://icons.terrastruct.com

icons

There's also been a major compiler rewrite. It's fixed many minor compiler bugs, but most importantly, it implements multi-board diagrams. Stay tuned for more as we write docs and make this accessible in the next release!

Features 🚀

  • double-border keyword implemented. #565
  • The Dockerfile now supports rendering PNGs #594
    • There was a minor breaking change as part of this where the default working directory of the Dockerfile is now /home/debian/src instead of /root/src to allow UID remapping with fixuid.
  • d2 fmt accepts multiple files to be formatted #718
  • font-size works for sql_table and class shapes #769
  • You can now use the reserved keywords layers/scenarios/steps to define diagrams with multiple levels of abstractions. Coming soon. #714

Improvements 🧹

  • Reduces default padding of shapes. #702
  • Ensures labels fit inside shapes with shape-specific inner bounding boxes. #702
  • dagre container labels changed positions to outside the shape. Many previously obscured container labels are now legible. #788
  • Container icons are placed top-left instead of center, to ensure no collisions with children. #806
  • Code snippets use bold and italic font styles as determined by highlighter #710, #741
  • Improves package shape dimensions with short height. #702
  • Sequence diagrams are rendered more compacted, both vertically and horizontally. #796
  • Keeps person shape from becoming too distorted. #702
  • Keeps oval shape from becoming too thin. #807
  • Ensures shapes with icons have enough padding for their labels. #702
  • --force-appendix flag adds an appendix to SVG outputs with tooltips or links. #761
  • d2 themes subcommand to list themes. #760
  • sql_table header left-aligned with column #769
  • Sequence diagram edge group labels are clearer #782

Bugfixes ⛑️

  • Fixes groups overlapping in sequence diagrams when they end in a self loop. #728
  • Fixes dimensions of unlabeled squares or circles with only a set width or height. #702
  • Fixes scaling of actor shapes in sequence diagrams. #702
  • Sequence diagram note ordering was sometimes wrong. #796
  • Images can now be set to sizes smaller than 128x128. #702
  • Tooltips with ampersand would result in invalid SVGs. #798
  • Fixes class height when there are no rows. #756
  • Border radius was not firefox-compatible. #799

Breaking changes

  • You can no longer use keywords intended for use under style outside and vice versa. e.g. obj.style.shape and obj.double-border are now illegal. The correct usages have always been obj.shape and obj.style.double-border; it just wasn't enforced until now.

v0.1.6

20 Jan 05:46
688f156
Compare
Choose a tag to compare

Many meaningful quality of life improvements and bug fixes, along with a few small features. Overall, a stabilizing set of changes, while some huge features are brewing in the background for the next release!

Thank you to the new contributors that have been joining us. If you want to get involved, there's lots of issues tagged with "good first issue" that are relatively easy to pick up. We're always around to lend a hand, and feel free to drop by our Discord if you're not sure where to start.

Have you enjoyed using D2? We're redesigning some of the site and will have a section for testimonials. If you'd like to be included with a few words alongside your name or public profile, please email us at hi@d2lang.com (or just post it somewhere and let us know)!

Features 🚀

  • animated keyword implemented for connections. #652
    animated connection example
  • border-radius keyword implemented for squares/rectangles. #688
  • circle arrowheads. #634

Improvements 🧹

  • ELK layouts tuned to have better defaults. #627
  • Code snippets of unrecognized languages will render (just without syntax highlighting). #650
  • Adds sketched versions of arrowheads. #656

Bugfixes ⛑️

  • Fixes code snippets not being tall enough with leading newlines. #664
  • Opacity was not being applied to labels of shapes (and other edge cases). #677
  • Fixes arrowheads sometimes appearing broken with sketch on. #656
  • Fixes attributes being ignored for sql_table to sql_table connections. #658
  • Icon URLs that needed escaping (e.g. with ampersands) are handled correctly by CLI. #666
  • Fixes self-connections inside layouts when using ELK. #676
  • Fixes inter-span messages between spans of the same actor in sequence diagrams. #694
  • Fixes arrowheads sometimes appearing broken in Dagre layouts. #649
  • Fixes tooltip/link attributes being ignored for sql_table and class. #658
  • Bounding box was not accounting for dimensions added by multiple and 3d keywords, which made them look cut off with 0 padding. #684, #685
  • Fixes markdown shapes being slightly too short for their text in some cases. #665
  • Fixes panic when the only diagram object has near set to a constant. #687