Skip to content

Commit 2d60770

Browse files
chore: default use_dot to false
matches the likec4 preview server, which uses the bundled wasm layout engine. the previous default required graphviz to be installed and silently produced layouts differing from the preview, which surprised users. opt into graphviz with use_dot: true.
1 parent 3971abf commit 2d60770

5 files changed

Lines changed: 22 additions & 22 deletions

File tree

docs/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## Requirements
66

77
- [`likec4`](https://likec4.dev/tooling/cli/)
8-
- `graphviz` dependency (see also [use_dot](#use_dot) below)
8+
- `graphviz` (optional, only when [use_dot](#use_dot) is enabled)
99

1010
Check out the sample [Dockerfile](https://github.com/doubleSlashde/mkdocs-likec4/blob/main/Dockerfile) for how you can provide the likec4 and graphviz dependencies.
1111

@@ -32,15 +32,15 @@ That's it! The plugin automatically:
3232

3333
### use_dot
3434

35-
By default mkdocs-likec4 uses local graphviz binaries instead of bundled WASM (as it has [memory issues](https://github.com/likec4/likec4/issues?q=Memory%20type:Bug)).
35+
By default mkdocs-likec4 uses the bundled WASM layout engine, matching the behaviour of the `likec4` preview server.
3636

37-
You can override it with the `use_dot: false` setting:
37+
You can opt into local graphviz binaries (which avoids known WASM [memory issues](https://github.com/likec4/likec4/issues?q=Memory%20type:Bug)) with `use_dot: true`. Note that this might result in a different layout than what the LikeC4 preview renders.
3838

3939
```yaml
4040
plugins:
4141
- search
4242
- likec4:
43-
use_dot: false
43+
use_dot: true
4444
```
4545

4646
### color_scheme

mkdocs_likec4/generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def generate(
2828
build_dir: str,
2929
site_dir: Path,
3030
*,
31-
use_dot: bool = True,
31+
use_dot: bool = False,
3232
) -> None:
3333
"""Generate web component JS file for a LikeC4 project."""
3434
if project_name is not None and not LikeC4Parser.is_valid_identifier(

mkdocs_likec4/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class LikeC4Plugin(BasePlugin):
2121
"""MkDocs plugin for embedding LikeC4 architecture diagrams."""
2222

2323
config_scheme = (
24-
("use_dot", config_options.Type(bool, default=True)),
24+
("use_dot", config_options.Type(bool, default=False)),
2525
(
2626
"color_scheme",
2727
config_options.Choice(["auto", "light", "dark"], default="auto"),

tests/test_generator.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_generate_default_project(self, mock_run, tmp_path):
5353
assert call_args[1] == "likec4"
5454
assert call_args[2] == "codegen"
5555
assert call_args[3] == "webcomponent"
56-
assert "/docs" in call_args[4]
56+
assert "/docs" in call_args
5757
assert "--webcomponent-prefix" not in call_args
5858
# Verify check=True is passed for proper error handling
5959
assert call_kwargs.get("check") is True
@@ -157,8 +157,8 @@ def test_generate_output_path(self, mock_run, tmp_path):
157157
assert "likec4_views_proj.js" in output_path
158158

159159
@patch("mkdocs_likec4.generator.subprocess.run")
160-
def test_generate_use_dot_true_by_default(self, mock_run, tmp_path):
161-
"""Test that --no-use-dot flag is not added by default (use_dot=True)."""
160+
def test_generate_use_dot_false_by_default(self, mock_run, tmp_path):
161+
"""Test that --no-use-dot flag is added by default (use_dot=False)."""
162162
site_dir = tmp_path / "site"
163163
site_dir.mkdir()
164164

@@ -170,11 +170,11 @@ def test_generate_use_dot_true_by_default(self, mock_run, tmp_path):
170170
)
171171

172172
call_args = mock_run.call_args[0][0]
173-
assert "--no-use-dot" not in call_args
173+
assert "--no-use-dot" in call_args
174174

175175
@patch("mkdocs_likec4.generator.subprocess.run")
176-
def test_generate_use_dot_false(self, mock_run, tmp_path):
177-
"""Test that --no-use-dot flag is added when use_dot=False."""
176+
def test_generate_use_dot_true(self, mock_run, tmp_path):
177+
"""Test that --no-use-dot flag is omitted when use_dot=True."""
178178
site_dir = tmp_path / "site"
179179
site_dir.mkdir()
180180

@@ -183,8 +183,8 @@ def test_generate_use_dot_false(self, mock_run, tmp_path):
183183
project_dir=None,
184184
build_dir="/docs",
185185
site_dir=site_dir,
186-
use_dot=False,
186+
use_dot=True,
187187
)
188188

189189
call_args = mock_run.call_args[0][0]
190-
assert "--no-use-dot" in call_args
190+
assert "--no-use-dot" not in call_args

tests/test_plugin.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def plugin():
1313
"""Create a fresh plugin instance with default config."""
1414
p = LikeC4Plugin()
15-
p.config = {"use_dot": True, "color_scheme": "auto"}
15+
p.config = {"use_dot": False, "color_scheme": "auto"}
1616
return p
1717

1818

@@ -380,8 +380,8 @@ def test_skips_undiscovered_projects(self, mock_generate, plugin, tmp_path):
380380
assert call_args[0] == "proj1"
381381

382382
@patch("mkdocs_likec4.plugin.WebComponentGenerator.generate")
383-
def test_passes_use_dot_true_by_default(self, mock_generate, plugin, tmp_path):
384-
"""Test that use_dot defaults to True."""
383+
def test_passes_use_dot_false_by_default(self, mock_generate, plugin, tmp_path):
384+
"""Test that use_dot defaults to False."""
385385
plugin.docs_dir = tmp_path / "docs"
386386
plugin.docs_dir.mkdir()
387387
plugin.project_map = {"proj": "proj"}
@@ -394,18 +394,18 @@ def test_passes_use_dot_true_by_default(self, mock_generate, plugin, tmp_path):
394394
plugin.on_post_build(config)
395395

396396
mock_generate.assert_called_once()
397-
assert mock_generate.call_args.kwargs["use_dot"] is True
397+
assert mock_generate.call_args.kwargs["use_dot"] is False
398398

399399
@patch("mkdocs_likec4.plugin.WebComponentGenerator.generate")
400-
def test_passes_use_dot_false_when_configured(
400+
def test_passes_use_dot_true_when_configured(
401401
self, mock_generate, plugin, tmp_path
402402
):
403-
"""Test that use_dot=False is passed when configured."""
403+
"""Test that use_dot=True is passed when configured."""
404404
plugin.docs_dir = tmp_path / "docs"
405405
plugin.docs_dir.mkdir()
406406
plugin.project_map = {"proj": "proj"}
407407
plugin.page_projects = {"page.md": {"proj"}}
408-
plugin.config["use_dot"] = False
408+
plugin.config["use_dot"] = True
409409

410410
site_dir = tmp_path / "site"
411411
site_dir.mkdir()
@@ -414,7 +414,7 @@ def test_passes_use_dot_false_when_configured(
414414
plugin.on_post_build(config)
415415

416416
mock_generate.assert_called_once()
417-
assert mock_generate.call_args.kwargs["use_dot"] is False
417+
assert mock_generate.call_args.kwargs["use_dot"] is True
418418

419419

420420
class TestColorScheme:

0 commit comments

Comments
 (0)