backstage-plugin-techdocs-addon-mermaid
backstage-plugin-techdocs-addon-mermaid copied to clipboard
RFC: Automatic transforms to catalog entities in mermaid
I had an idea, but I don't know if it would actually be practical in the long term. This would make sense for diagrams where you are showing detail for how systems interact with one another. Like, I want to create very specific graphs for specific use cases of our enterprise.
I am looking for comment regarding a token you could add to your diagram nodes to indicate that they are catalog entities (ex: *** as a prefix for an entity to be followed by its entity ref (partial?))
- If that token is found in the diagram, before doing the render of the mermaid string, it would fetch the entity details for the indicated entities found from the catalog API.
- It would replace the text from the marker to the entity title and it would also make the diagram node a clickable link
For example:
graph
***system/my-system-->***system/another-system
would be converted to
graph
my-system[My system]-->another-system[Another System]
click my-system "/catalog/default/system/my-system" _blank
click another-system "/catalog/default/system/another-system" _blank
Cons:
- Mermaid preview works really well in markdown preview tools with the right extensions. This would make a real preview only possible in Backstage or with the TechDocs CLI.
- Potential security issue unless you only allow relative links .
- More complexity in the plugin.