mkdocs-d2-plugin

MkDocs plugin for D2

MIT 26 个版本 Python >=3.10
Michał Wieluński <michal@wielunski.net>
安装
pip install mkdocs-d2-plugin
poetry add mkdocs-d2-plugin
pipenv install mkdocs-d2-plugin
conda install mkdocs-d2-plugin
描述

mkdocs-d2-plugin

A plugin for embedding D2 diagrams in MkDocs.

Documentation and live demo can be found here.

Requirements

Installation

Install the plugin using pip:

pip install mkdocs-d2-plugin

And add it to your mkdocs.yml:

plugins:
  - d2

Usage

Fenced code block

```d2
shape: sequence_diagram
Alice -> John: Hello John, how are you?
Alice -> John.ack: John, can you hear me?
John.ack -> Alice: Hi Alice, I can hear you!
John -> Alice: I feel great!
```

Image tag

![Diagram](diagram.d2)

Demo app

You can find demo app in the docs directory. Live version is available here.

To run in locally:

cd docs
python3 -m venv .venv
source .venv/bin/activate
pip install mkdocs-material mkdocs-d2-plugin
mkdocs serve

To run it using Docker:

cd docs
docker build --tag mkdocs-d2-plugin:latest .
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-d2-plugin:latest
版本列表
1.7.0 2026-04-09
1.6.0 2024-12-16
1.5.0 2024-08-21
1.5.0b2 2024-08-20
1.4.0 2024-08-18
1.3.4 2024-05-22
1.3.3 2024-05-07
1.3.2 2024-05-07
1.3.1 2024-05-07
1.3.0 2024-03-31
1.2.3 2024-03-21
1.2.2 2024-01-03
1.2.0 2023-12-22
1.1.0 2023-11-06
1.0.1 2023-11-06
1.0.0 2023-11-05
0.4.1 2023-11-04
0.4.0 2023-11-04
0.3.0 2023-11-04
0.2.2 2023-09-26
0.2.1 2023-09-26
0.2.0 2023-09-26
0.1.0 2023-09-25
0.0.3 2023-09-23
0.0.2 2023-09-23
0.0.1 2023-09-22