required writting a simple awk script to add the necessary border for MarkDeep.. haven't integrated the diagram generation into the file yet..main
@@ -0,0 +1,6 @@ | |||||
# https://github.com/ironcamel/Graph-Easy | |||||
diag.txt: diag_inp.txt box.sh | |||||
graph-easy < $< | sh box.sh > $@ | |||||
diagtest: | |||||
ls box.sh diag_inp.txt Makefile | entr sh -c 'make diag.txt && cat diag.txt' |
@@ -0,0 +1,32 @@ | |||||
#!/bin/sh | |||||
fname=$(mktemp foobar.XXXXX) | |||||
cat > "$fname" | |||||
awk ' | |||||
maxline == 1 { | |||||
if (maxlength < length) | |||||
maxlength = length | |||||
} | |||||
function printtop () { | |||||
blank = "" | |||||
for (i = 0; i < maxlength + 4; i++) | |||||
blank = blank "*" | |||||
printf("%s\n", blank) | |||||
} | |||||
output == 1 && FNR == 1 { | |||||
printtop() | |||||
printf("* %*s *\n", maxlength, "") | |||||
} | |||||
output == 1 { | |||||
printf("* %s%*s *\n", $0, maxlength - length, "") | |||||
} | |||||
END { | |||||
printf("* %*s *\n", maxlength, "") | |||||
printtop() | |||||
} | |||||
' maxline=1 "$fname" maxline=0 output=1 "$fname" | |||||
rm "$fname" |
@@ -0,0 +1,25 @@ | |||||
********************************************************************************* | |||||
* * | |||||
* +-------------+ * | |||||
* | Internet | * | |||||
* +-------------+ * | |||||
* | * | |||||
* | * | |||||
* | * | |||||
* +----------------+ +-------------+ * | |||||
* | Host machine |-----------------------------| VLAN Switch | * | |||||
* +----------------+ +-------------+ * | |||||
* | | * | |||||
* | | * | |||||
* | | * | |||||
* +----------------+ +-----------------+ +-------------+ +--------+ * | |||||
* | USB Hub | --- | Power Controler | --- | RockPro64 | | 12V PS | * | |||||
* +----------------+ +-----------------+ +-------------+ +--------+ * | |||||
* | | | | * | |||||
* | +-----------------------+-------------------+ * | |||||
* | | * | |||||
* +----------------+ | * | |||||
* | Serial adapter |-------------------------------+ * | |||||
* +----------------+ * | |||||
* * | |||||
********************************************************************************* |
@@ -0,0 +1,9 @@ | |||||
[ Internet ] { flow: north } -- [ VLAN Switch ] | |||||
[ Host machine ] -- [ VLAN Switch ] | |||||
[ Host machine ] { flow: south } -- [ USB Hub ] | |||||
[ RockPro64 ] { flow: north } -- [ VLAN Switch ] | |||||
[ USB Hub ] -- [ Power Controler ] | |||||
[ USB Hub ] -- [ Serial adapter ] | |||||
[ Serial adapter ] -- [ RockPro64 ] | |||||
[ Power Controler ] -- [ 12V PS ] | |||||
[ Power Controler ] { flow: east } -- [ RockPro64 ] |