Refactor `diagrams` tool to allow using different output graph languages