Find a file
2023-12-11 18:15:49 +01:00
sphinxcontrib fix for pkg 2023-12-11 18:15:49 +01:00
pyproject.toml fix for pkg 2023-12-11 18:15:49 +01:00
README.md Update file README.md 2023-12-11 15:42:33 +00:00
setup.py fix for pkg 2023-12-11 18:15:49 +01:00

sphinxcontrib-d2lang

This is a Sphinx extension fori d2lang.

Usage

Install

$ pip install sphinxcontrib-d2lang

Adding the extension

conf.py

extensions = [
    "sphinxcontrib.d2lang",
]

Adding a diagram (inline)

You can use d2lang in sphinx directive

source/index.rst

Hello World
===========

.. d2lang::

    hello -> world

Adding a diagram (external file)

You can use an external file like this

Hello World
===========

.. d2lang:: helloworld.d2

Options

There is two options you can use

  • layout
  • filename

Layout engine

You can specify layout engine to use

Hello World
===========

.. d2lang::
   :layout: elk

    hello -> world

Output filename

Hello World
===========

.. d2lang::
   :filename: d2lang_files/helloworld.svg

    hello -> world