The pikchr program was inspired by pic, and is somewhat compatible, and can
output SVG.
https://pikchr.org/home/doc/trunk/homepage.md
https://pikchr.org/home/doc/trunk/doc/differences.md
I have not used it, but it might be useful.
Niklaus Wirth used railroad diagrams in the Pascal User Manual an
I have a public groff demonstration project. Its purpose is to show
the world what groff + mandoc can produce in terms of technical
documentation, and to show ourselves what it cannot do. I'd like to
ask first for suggestions on how to bring it up to the state of the
art. Then see what we can do