Skip to content

Commit 629cf00

Browse files
committed
dot docs
1 parent ad642e9 commit 629cf00

File tree

3 files changed

+57
-4
lines changed

3 files changed

+57
-4
lines changed

docs/.observablehq/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default {
1313
{path: "/javascript/mutables", name: "Mutables"},
1414
{path: "/javascript/imports", name: "Imports"},
1515
{path: "/javascript/inputs", name: "Inputs"},
16-
{path: "/dot", name: "Dot"},
16+
{path: "/dot", name: "DOT"},
1717
{path: "/mermaid", name: "Mermaid"},
1818
{path: "/tex", name: "TeX"},
1919
{path: "/loaders", name: "Data loaders"},

docs/dot.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,56 @@
1-
# Dot
1+
# DOT
22

3-
```dot show
3+
[DOT](https://graphviz.org/doc/info/lang.html) is a language for rendering node-link diagrams using [Graphviz](https://graphviz.org). Observable Markdown’s implementation is powered by [Viz.js](https://github.com/mdaines/viz-js).
4+
5+
To use DOT, write a `dot` fenced code block:
6+
7+
````md
8+
```dot
49
digraph G {
10+
rankdir = LR
511
a -> b -> c
612
}
713
```
14+
````
15+
16+
This produces:
17+
18+
```dot
19+
digraph G {
20+
rankdir = LR
21+
a -> b -> c
22+
}
23+
```
24+
25+
Here are some more examples.
26+
27+
```dot show
28+
graph { n0 -- n1 -- n2 -- n3 -- n0 }
29+
```
30+
31+
```dot show
32+
digraph { x -> y -> z }
33+
```
34+
35+
```dot show
36+
digraph G {
37+
subgraph cluster_0 {
38+
a0 -> a1 -> a2 -> a3
39+
label = "process #1"
40+
}
41+
subgraph cluster_1 {
42+
b0 -> b1 -> b2 -> b3
43+
label = "process #2"
44+
color = blue
45+
}
46+
start -> a0
47+
start -> b0
48+
a1 -> b3
49+
b2 -> a3
50+
a3 -> a0
51+
a3 -> end
52+
b3 -> end
53+
start [shape = Mdiamond]
54+
end [shape = Msquare]
55+
}
56+
```

public/client.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ async function dot() {
116116
while (++i < n) string += arguments[i] + "" + strings[i];
117117
const svg = viz.renderSVGElement(string, {
118118
graphAttributes: {
119-
bgcolor: "none"
119+
bgcolor: "none",
120+
color: "#00000101",
121+
fontcolor: "#00000101",
122+
fontname: "var(--sans-serif)",
123+
fontsize: "12"
120124
},
121125
nodeAttributes: {
122126
color: "#00000101",

0 commit comments

Comments
 (0)