{"repo":"peter-gy/d2-widget","free":true,"listed":false,"github":"https://github.com/peter-gy/d2-widget","clone":"git clone https://github.com/peter-gy/d2-widget.git","description":"🔵 D2: Declarative Diagramming in Python via AnyWidget","language":"Python","stars":24,"topics":["anywidget","d2","jupyter-notebook","marimo","d2-language","data-visualization","diagrams","interactive-diagrams","jupyter-extension","jupyter-magic"],"license":"MIT","category":"analytics","readme_excerpt":"D2 Widget Bring the power of D2 to Python notebooks. d2-widget is an AnyWidget for displaying declarative diagrams written in D2. - 🎨 D2 Diagram Rendering : Create and display interactive D2 diagrams directly in Python notebooks - ⚙️ Configurability : Support for all D2 compilation options including themes, layouts, and rendering configurations - 📤 SVG Export : Programmatically access the SVG representation for use in other documents - ✨ Jupyter Cell Magic : Use the convenient %%d2 cell magic for quick diagram creation - 🧩 Notebook Compatibility : Works in Jupyter, Google Colab, Marimo, and other AnyWidget-enabled Python notebook environments - 🎬 Animation Support : Create animated diagrams with D2's native animation capabilities Playground Visit the interactive playground to try out what d2-widget can do. Installation or with uv: Usage The following examples demonstrate how to use Widget with increasing complexity. Basic Usage The simplest way to use Widget is to pass a D2 diagram as a string to the constructor. Inline Configuration You can add direction and layout settings directly in the D2 markup. Compile Options You can specify compile options using the second argument to the constructor. You can read about the semantics of the options in the D2 documentation. Accessing the SVG You can access the generated SVG using the svg attribute. %%d2 Cell Magic You can use the %%d2 cell magic to display a D2 diagram in a Jupyter notebook. First, you need to load the extension: ","default_branch":null,"files":null,"tree":[],"storefront":"/r/peter-gy","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/peter-gy/d2-widget/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}