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 81a5fdf
Show file tree
Hide file tree
Showing 3 changed files with 34 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
22 changes: 21 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ on:
jobs:
Test:
runs-on: ubuntu-latest
services:
graphviz:
image: ghcr.io/ikalnytskyi/dot:latest
options: --name graphviz --interactive
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

Expand All @@ -19,10 +27,22 @@ jobs:

- name: Set up dependencies
run: |
sudo apt install inkscape graphviz
sudo apt install inkscape
cat << EOF > /usr/local/bin/dot
#!/bin/sh
exec /usr/bin/docker exec --interactive graphviz /usr/bin/dot $@
EOF
chmod +x /usr/local/bin/dot
python -m pip install --upgrade pip
python -m pip install --requirement requirements.txt
- uses: mxschmitt/action-tmate@v3

- name: Run Holocron
run: holocron run compile

- name: Test
run:
grep "svg" _site/posts/on-tmux-osc52-support/index.html
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 81a5fdf

Please sign in to comment.