diff --git a/docs/_diagrams/README.md b/docs/_diagrams/README.md index 7014ae378..90be8f2e6 100644 --- a/docs/_diagrams/README.md +++ b/docs/_diagrams/README.md @@ -17,10 +17,7 @@ The schema structure diagram is done with LaTeX. You can use a GUI like https:// Then use this command to generate the png file. ```bash -pdflatex --shell-escape -halt-on-error db.tex - -## and move it to the static folder(it's not easy to do it in one go with the pdflatex) -mv db.png ../_static/ +postgrest-docs-render ``` LaTeX is used because it's a tweakable plain text format. diff --git a/nix/tools/docs.nix b/nix/tools/docs.nix index c2c18728f..100abd916 100644 --- a/nix/tools/docs.nix +++ b/nix/tools/docs.nix @@ -2,8 +2,10 @@ , aspellDicts , buildToolbox , checkedShellScript +, imagemagick , python3 , python3Packages +, texlive , writers }: let @@ -56,6 +58,19 @@ let fi ''; + render = + checkedShellScript + { + name = "postgrest-docs-render"; + docs = "Render the diagrams."; + workingDir = "/docs/_diagrams"; + withTmpDir = true; + } + '' + ${texlive.combined.scheme-full}/bin/pdflatex -halt-on-error -output-directory="$tmpdir" db.tex + ${imagemagick}/bin/convert -density 300 "$tmpdir/db.pdf" ../_static/db.png + ''; + server = writers.writePython3 "postgrest-docs-server" @@ -165,6 +180,7 @@ buildToolbox check dictcheck linkcheck + render serve spellcheck ];