0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-11-30 19:03:43 -05:00
forgejo-docs/scripts/mermaid_image_generate.sh
Michael Jerger 98dac9cb1f Documentation for federated-star (#639)
Preview:

* https://forgejo.codeberg.page/@docs_pull_639/docs/next/developer/federation-architecture/
* https://forgejo.codeberg.page/@docs_pull_639/docs/next/developer/threat-analysis/
* https://forgejo.codeberg.page/@docs_pull_639/docs/next/developer/adr/

Co-authored-by: patdyn <erik.seiert@meissa-gmbh.de>
Co-authored-by: Clemens <clemens.geibel@meissa-gmbh.de.de>
Reviewed-on: https://codeberg.org/forgejo/docs/pulls/639
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
2024-06-29 16:47:25 +00:00

24 lines
No EOL
708 B
Bash
Executable file

#!/usr/bin/env sh
current_branch=$(git branch --show-current)
repo_path=$(pwd)
mermaid_path=$repo_path/docs/_mermaid
mermaid_img_path=$repo_path/docs/_mermaid/_images
# Clean generated svg files
for file in $(find $mermaid_img_path -type f -name "*.svg" -printf "%p\n")
do
rm $file
done
# Generate svg files
for file in $(find $mermaid_path -path $mermaid_img_path -prune -o -type f -name "*.md" -printf "%p\n")
do
echo "MD FILE: $file"
dir_md=$(dirname "$file")
dir_relative=${dir_md#*docs/_mermaid/}
dir_output=$(echo "$mermaid_img_path/$dir_relative")
mkdir -p $dir_output
name=$(basename "$file" ".md")
$repo_path/node_modules/.bin/mmdc -i $file -o $(echo "$dir_output/$name.svg")
done