Skip to content

Commit

Permalink
Use 'dot -Tsvg_inline' to render diagrams
Browse files Browse the repository at this point in the history
The `svg_inline` output format has been added to Graphviz 10.0, and
doesn't contain XML headers, making rendered SVGs suitable for embedding
into web pages. This patch install latest graphviz via homebrew (sorry)
because even the most recent Ubuntu comes w/ super old graphviz in its
repositories.
  • Loading branch information
ikalnytskyi committed May 1, 2024
1 parent 145c96d commit 98334e0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@ jobs:

- name: Set up dependencies
run: |
sudo apt install inkscape graphviz
sudo apt install inkscape
curl --progress-bar --remote-name --output-dir $RUNNER_TEMP $GRAPHVIZ_DOWNLOAD_URL
tar -xzf $RUNNER_TEMP/*.tar.gz --directory $RUNNER_TEMP
pushd $RUNNER_TEMP/graphviz-*/
./configure --with-rsvg=yes --disable-swig
make -j4
sudo make install
popd
python -m pip install --upgrade pip
python -m pip install --requirement requirements.txt
env:
GRAPHVIZ_DOWNLOAD_URL: https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/11.0.0/graphviz-11.0.0.tar.gz

- name: Run Holocron
run: holocron run compile
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,27 @@ jobs:

- name: Set up dependencies
run: |
sudo apt install inkscape graphviz
sudo apt install inkscape
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io --username ikalnytskyi --password-stdin
docker run --rm --interactive --name graphviz $GRAPHVIZ_IMAGE
echo "#!/bin/sh" > /usr/local/bin/dot
echo "docker exec --interactive graphviz /usr/bin/dot $@"
chmod +x /usr/local/bin/dot
# curl --progress-bar --remote-name --output-dir $RUNNER_TEMP $GRAPHVIZ_DOWNLOAD_URL
# tar -xzf $RUNNER_TEMP/*.tar.gz --directory $RUNNER_TEMP
# pushd $RUNNER_TEMP/graphviz-*/
# ./configure --with-rsvg=yes --disable-swig
# make -j4
# sudo make install
# popd
python -m pip install --upgrade pip
python -m pip install --requirement requirements.txt
env:
GRAPHVIZ_IMAGE: ghcr.io/ikalnytskyi/dot:latest
#GRAPHVIZ_DOWNLOAD_URL: https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/11.0.0/graphviz-11.0.0.tar.gz

- name: Run Holocron
run: holocron run compile
4 changes: 2 additions & 2 deletions posts/2023-11-14_on-tmux-osc52-support/index.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ within. Needless to say that a NeoVim instance running inside container has no
access to the system clipboard[^2], and this is where OSC-52 comes to the
rescue!

```dot { "exec": ["dot", "-Tsvg"] }
```dot { "exec": ["dot", "-Tsvg_inline"] }
digraph G {
pencolor = "#2E3440"
style = dashed
Expand Down Expand Up @@ -78,7 +78,7 @@ copying: we just send a text we want to copy to all clients and let their
terminal emulators to set the system clipboard. But what should we do with
pasting? What attached client should be used as a clipboard source?

```dot { "exec": ["dot", "-Tsvg"] }
```dot { "exec": ["dot", "-Tsvg_inline"] }
digraph G {
pencolor = "#2E3440"
style = dashed
Expand Down

0 comments on commit 98334e0

Please sign in to comment.